Rusty Russell
3a803eefbb
bitcoin/tx: move bitcoin_tx_from_file() to test-cli, expose bitcoin_tx_from_hex()
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
04fd2c861f
bitcoin/base58: p2sh address support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
2516a187bc
test-cli: use OpenChannel__AnchorOffer instead of book for open_channel_pkt()
Clearer by being more explicit.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
08367f8716
state: order headers correctly.
make check-source will complain once we include state.c.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
bbd9d4aa01
state: inline input_is_pkt().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
15c5fca876
state: take struct peer instead of struct state_data.
Just a name change for the test code, but this is what we'll be using
for the daemon.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
2c356fde55
state: remove unnecessary set_errpkt() helper.
This was needed when idata->pkt wasn't a tal pointer, for testing,
but now it always is anyway.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
85f4a7cf14
state: simplify effect.
Make it a linked list of effects, rather than one big union.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4d22b4e3eb
pkt_open: use flag to indicate whether packet will offer anchor.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
93b5db89a8
signature: expose check_signed_hash()
This is wanted for crypto communications to check signature.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
888389e625
ccan: update and add more.
We need the following additional modules for the daemon:
io, time, timer, pipecmd
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
906a5e4a32
Move pkt.c into test-cli.
We use cryptopkt for normal cases.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
b312114719
pkt: don't convert endian on header.
This is now only used for internal tests, so endian conversion is overkill.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
a38d0c985e
Makefile: more fascist warnings.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4163935bbb
ccan: import time module.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
e97e8988f8
ccan: import isaac and dependencies.
We could probably just use Openssl's RAND_pseudo_bytes, but this gives
a nice interface to get a number between 1 and N.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4795a4d46f
Makefile: sanity check source and makefile
This enforces the include order implemented by the previous patch, and
also make sure we haven't missed any headers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
9ebbe16b1e
source cleanup: sort include lines into alpha order
This makes merging easier in future.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
d733e82352
header cleanup: sort include lines into alpha order, after config.h
This makes merging easier in future.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
4dafeba857
Makefile: depend on headers.
A halfway house between the horror of dynamic generation and the fail of
making everything depend on every header.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
ffe20fb2ae
bitcoin: add OP_CHECKLOCKTIMEVERIFY support (BIP65)
No need to use noops now that BIP65 is active.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
Rusty Russell
aeedafc20f
Switch to bitcoind by default.
I haven't implemented getting transactions from alphad (it needs the values
for the inputs, too), so switch to bitcoind.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years ago
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