Commit Graph

107 Commits

Author SHA1 Message Date
Rusty Russell 3f374d8d8b check-bolt: handle references to early-drafts too.
Particularly for the onchain.md draft.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-04 16:03:04 +09:30
Rusty Russell 9eabab78ab utils: tal_hexstr() helper.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-03 11:28:49 +09:30
Rusty Russell a150bd191a remove_dust: don't ever create dust outputs.
This behavior will be specified in BOLT #3.

Closes: #14

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-03 11:28:49 +09:30
Rusty Russell 4bbb86ae30 daemon: clean up test dirs.
Move final helpers out of test-cli/

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-03 11:27:56 +09:30
Rusty Russell 03a538ca02 check-bolt: check that comments in code match the specs.
And fix the mistakes!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-03 11:27:56 +09:30
Rusty Russell 5ba7692254 Makefile: fix config.h rebuilds in parallel.
Occasionally make seems to rebuild this in parallel, so make sure to
never have a partially complete one.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-05-03 11:27:56 +09:30
Rusty Russell e7b9a913a6 bitcoind: getrawblock helper.
It turns out using the verbose=false parameter, you can get the raw block
from getblock.  Do that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-24 19:40:29 +09:30
Rusty Russell 410fc3b272 misc: remove some unused functions.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-24 19:33:13 +09:30
Rusty Russell 6b956ea22a varint: new file.
Move varint handling from tx.c and generalize it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-12 13:07:03 +09:30
Rusty Russell ed70b13041 bitcoin: add first unit test.
Should grow from here.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-11 16:42:53 +09:30
Rusty Russell f8796c261b Make BIP68 and CSV support the default.
This has gone upstream into bitcoind, so enable it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-11 16:35:29 +09:30
Rusty Russell 8104886503 Remove Alpha support.
I had already disabled it, and this clears the decks for Segregated Witness
which gives us everything we want.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-11 16:32:43 +09:30
Rusty Russell 18a9e5bda2 daemon: Implement encryption as per BOLT #1.
This uses libsodium (we could use openssl, but the required primitives
are only in 1.1.0 which is still in alpha).

It doesn't handle reconnections yet, either.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-16 16:06:17 +10:30
Rusty Russell 64e5ce1530 test: remove test_state_coverage
We're going to change the protocol to send multiple changes at once, so
disable this compilation and testing for now.

We can revisit it afterwards once the protocol is stable again.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-15 17:07:31 +10:30
Rusty Russell 09358498cd Remove test-cli
We're about to change the protocol again, and I don't want to do the
grunt work to update these.  They were useful for pre-build protocol
testing, though.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:37:15 +10:30
Rusty Russell b280cab6b0 Makefile: clean daemon files with make clean.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:32:15 +10:30
Braydon Fuller e0c4d40899 doc: add install notes 2016-02-24 23:59:33 -05:00
Rusty Russell 6750794667 Use #if instead of #ifdef (we already use -Wundef).
This avoids embarassing typos in future.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-27 15:00:50 +10:30
Rusty Russell 1e93da5513 Really enable checklocktimeverify support.
Next patch will make sure this never happens again.

Fixes: #18
Reported-by: Fabrice
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-27 14:52:30 +10:30
Rusty Russell d3455e7c22 Add brief HACKING.md, and update name.
Each release gets names by a new contributor: this one thanks to
Anthony Towns!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:49:47 +10:30
Rusty Russell b70c18a40e daemon: implement anchor watch timeout.
We abort when this happens, but still worth testing.

This involves a refactor so we can allocate watches off a specific context,
for easy freeing when they're no longer wanted.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell f5538bd1d2 daemon: test scripts.
We comment out the peer_create_close_tx() abort for now, so we
can test.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell 378dadc371 daemon: configuration directory (default ~/.lightning).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell 117cf6b02d daemon: add logging options.
Particularly logging to file.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30
Rusty Russell 3e77c55a3b Makefile: add daemon source sanity checks.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30
Rusty Russell dd35260ce8 daemon: first code.
Logging code based heavily on pettycoin's.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30
Rusty Russell caa27f1d93 names.h/names.c: wrappers to get name for states/inputs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:46 +10:30
Rusty Russell e6dfff3ba8 licensing: Make license explicit.
Note that we're BSD-MIT but some of the ccan modules are different
licenses.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:46 +10:30
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>
2016-01-22 06:41:46 +10:30
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>
2016-01-22 06:41:45 +10:30
Rusty Russell 906a5e4a32 Move pkt.c into test-cli.
We use cryptopkt for normal cases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:45 +10:30
Rusty Russell a38d0c985e Makefile: more fascist warnings.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:37 +10:30
Rusty Russell 4163935bbb ccan: import time module.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:38:09 +10:30
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>
2016-01-22 06:38:09 +10:30
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>
2016-01-22 06:38:09 +10:30
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>
2016-01-22 06:38:08 +10:30
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>
2016-01-22 06:38:08 +10:30
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>
2016-01-22 06:38:08 +10:30
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>
2016-01-22 06:38:08 +10:30
Rusty Russell 45e0ab11ff Merge branch 'onion' 2016-01-22 06:35:11 +10:30
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>
2015-10-26 21:06:23 +10:30
Anthony Towns b66852f1ab Makefile: add python onion tests 2015-10-06 23:49:52 +10:00
Anthony Towns 2042e1cdb7 onion_key: generate multiple keys at once 2015-10-06 23:49:52 +10:00
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>
2015-10-06 12:03:53 +10:30
Rusty Russell 32a08ce6c5 test/onion_key: helper to generate deterministic key pairs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-10-06 12:03:09 +10:30
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>
2015-09-30 16:39:02 +09:30
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>
2015-09-30 16:39:02 +09:30
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>
2015-09-30 16:37:21 +09:30
Rusty Russell 17f457568a Makefile: generate libsecpk1 properly.
And clean it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-09-30 10:54:54 +09:30
Rusty Russell 454a3867e5 BIP68 support (nSequence enforcement)
The latest version of the BIP doesn't use inversion, but does use
bitshifts.

It also uncovered a bug in the test scripts: the block timestamps
creep forward when we generate large numbers of blocks (UpdateTime
insists it be > GetMedianTimePast() so it's valid).  We need to take
this into account when waiting for the median to move (reduced it from
60 to 30 seconds, since that adds about 14 seconds).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-09-30 10:54:11 +09:30