Rusty Russell
e272d759a5
Force -walletbroadcast=1 for tests.
Since lightningd wants walletbroadcast=0, override it on cmdline.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
2e873af86f
locktime: complete the set of conversion functions.
And add protobuf_convert helpers, too.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4b02c6f558
locktime: nice abstractions for absolute and relative locktimes.
I got confused navigating these, especially since Alpha and Bitcoin
have diverged (BIP68 was proposed after Elements Alpha).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4c42930940
bitcoin/tx, protobuf_convert: support BIP68 as implemented.
The format for both the nSequence field and the stack arg for
OP_CHECKSEQUENCEVERIFY is either:
Time-relative: [Bit 22 = 1] 00000 <time-shifted-by-9>
Block-relative: [Bit 22 = 0] 00000 <number of blocks>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
f710ba7c37
scripts/test.sh: boost CSV time to 512 seconds.
As per BIP68, that's the minimum.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4e23f9916d
script: encode numbers minimally.
This happens for CSV, for example (3-byte encoding), and bitcoind treats
too-long encodings as non-standard.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
0ef2b9a32e
test-cli: fix htlc balance on fulfill, and add assert that total is invariant.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
deb2e7b654
daemon/jsmn: Add submodule for jsmn.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
45e0ab11ff
Merge branch 'onion'
9 years ago
Rusty Russell
5de21f80de
Regenerate PDF.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Douglas Roark
6394d2de16
Minor "Reaching the Ground With Lightning" fixes.
- Added a reference to BIP112 and to the deployment of BIP68.
- Minor typo, grammar and formatting fixes.
9 years ago
Rusty Russell
6b2d844f2a
bitcoin: use ccan/mem instead of rolling own check_mem function.
Reported-by: John Newbery
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
be58e45ee4
README.md: A few more details about what we're doing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
2ab9e3bd7f
doc/deployable-lightning: corrections and fixes.
1) Note incorrect label in txs in Fig1 of LN paper.
2) "an atomic-swap an on-chain.." -> "an atomic-swap *to* an on-chain"
3) "By using a dual anchor and escape transactions" -> "By using a rebalanced single anchor"
4) References to appendices fixed.
5) Move escape transaction scripts out to escape appendix.
6) Fix URL in bibliography (missing comma).
Reported-by: John Newbery
Closes : #11
Closes : #12
Reported-by:
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
57f0c3b38c
test-cli/scripts: use setmocktime.
TIL about setmocktime.
Suggested-by: Gavin <gavinandresen@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
32fe988fe8
bitcoin: signature fixes.
The libsecp change broke signature checking. Disable it for now,
with a big FIXME. The next version should have a method for S value
checking, and also compact serialization.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Anthony Towns
cadaa348e3
test_onion.py: drop repeated sha calculation
9 years ago
Rusty Russell
beb702054b
test_onion: minor protocol change; use single SHA to create both IVs.
Suggested-by: Anthony Towns <aj@erisian.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
0c4eb06e26
test_onion: remove gratuitous dynamic alloc, cleanup on exit.
We skipped freeing the context in the too-many-hops case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
064cf6cc39
test/onion_key: code cleanup.
Use ccan/opt, make arguments bool, remove commented-out code.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Anthony Towns
b66852f1ab
Makefile: add python onion tests
9 years ago
Anthony Towns
626be23180
test_onion.py: control generate/decode from command line
9 years ago
Anthony Towns
beafbe1c19
test_onion.c: generate message predictably
Generate sample encrypted payload based on actual pubkey, not
libsecp256k1's internal representation of the pubkey.
9 years ago
Anthony Towns
9ffac49c6f
onion_key: allowing both odd and even pubkeys
output compressed public keys; accept compressed pubkey in test_onion
9 years ago
Anthony Towns
2042e1cdb7
onion_key: generate multiple keys at once
9 years ago
Rusty Russell
ed46dd355d
test_onion: split encode and decode, drive from cmdline.
This lets us test interaction with python code, for example.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
7c36a3e058
test_onion: get rid of dummy crypto options.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
32a08ce6c5
test/onion_key: helper to generate deterministic key pairs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
9aa8907e38
test_onion: Rename struct pubkey to struct onion_pubkey.
And move to onion_key.h for next patch.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
8e9944bc37
test: add .gitignore
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
f693060068
test_onion: fix random padding.
Randomness is now at start; thanks valgrind!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Anthony Towns
8b0635f7d3
test_onion.py: make it possible to build an onion
switched from pyelliptic to hmac/binascii/cryptography for standard
functions
use our own ECDH implementation to better match the one from secp256k1
finally, add function to create an encrypted onion
9 years ago
Anthony Towns
bb26fc3026
test_onion.py: drop unused part of message secrets
9 years ago
Anthony Towns
53e13e69c9
test_onion.py: drop separate padding method
9 years ago
Anthony Towns
75dceaf254
test_onion.py: alternative onion peeling implementation
9 years ago
Anthony Towns
b2c86c650a
test_onion: dump more output
9 years ago
Rusty Russell
e165d0009c
test_onion: Switch from AES256 to AES128.
AFAICT, if SHA256 is good enough, and secp256k1 is good enough, AES128
is good enough.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
927bc28c8e
test_onion: always generate 0x2 keys.
This means they're 32 bytes, which works better for everything.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
90794d8ebf
test_onion: generate onion in place.
Rather than keeping each hop, we can generate it in place since we only
need the first hop result.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
6aae8d6257
test_onion: keep hmacs rather than padding.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
154b917680
test_onion: put padding at the front.
This means we can save the partial HMAC of the padding for each step,
rather than the padding itself, when generating it.
Each step now takes the *last*, not *first* part of the onion array.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
0b50a7c9eb
Fix test scripts for alpha.
Doesn't support getblockheader, also some occasional weirdness
with sequence enforcement for mempool? Occasionally I could get
my spend tx into the mempool (doesn't happen with bitcoin).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
f36ba8f8e1
Makefile: only erase protobuf and PDF files with maintainer-clean.
Reported-by: Anthony Towns
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
401bde5c6b
secp256k1: add "ignored" files.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
3120bc6231
secp256k1: update to cc3141a00368c8d83dc35243f4936694304d62dc
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
81d35294f4
test/test_onion: demo program to show onion routing crypto.
We can make this more efficient, but this works for now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
b47d4bbe6a
ccan: add ccan/mem.
Onion test program wants memcheck().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
c895d4a135
ccan: update to latest.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
242fa1b2dd
pubkey: pubkey_eq helper.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
e7856e6e69
Update libsecp to git@github.com:bitcoin/secp256k1.git 52fd03f
We want the ecdh stuff for onion routing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago