Rusty Russell
4f67b59c26
protocol: rename routefail to fail.
...
It's a generic "I couldn't complete this" failure.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:41:15 +10:30
Rusty Russell
3494cbfb7c
protocol: remove update message
...
We never do unilateral transfers, except via an HTLC.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:40:15 +10:30
Rusty Russell
40361e3dd8
state: explicit callback to check pkt_open_complete.
...
For now, this always succeeds, but include the hook for completeness.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:39:15 +10:30
Rusty Russell
a2f4000d22
state: cleanup after anchor has been transmitted.
...
If something goes wrong after we've broadcast the anchor tx, we need to use
the commit tx to spend it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:38:15 +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
35ab923163
peer: fix dangling peer->current_htlc->htlc pointer.
...
It currently points into freed memory once we've make_commit_txs; we
don't currently dereference it after that, but I did in some test code
and got a surprise. Make a copy in all cases where we set it, so
there can't be lifetime problems.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:36:15 +10:30
Rusty Russell
3fbee72f3a
daemon/test: make --verbose flag less verbose.
...
Just print out the commands we do, not -x which gives TMI.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:35:15 +10:30
Rusty Russell
ae82c0a12c
daemon/test: Make --gdb1/--gdb2 actually work, clean up params.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:34:15 +10:30
Rusty Russell
16a7e3dc97
daemon/test: always test with valgrind, don't print errors unless a problem.
...
Unfortunately this seems to require longer sleeps.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:33: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
Rusty Russell
c1d1b360bf
daemon: add memcheck() in various places where we expect things to be initialized.
...
This just causes valgrind to warn sooner.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:31:15 +10:30
Rusty Russell
ab1176d218
jsonrpc: rename "id" to "peerid" everywhere.
...
To be distinct from HTLC ids.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:30:15 +10:30
Rusty Russell
48a4ec88dd
daemon/test/test.sh: remove -x flag, add --verbose option.
...
--verbose also turns on grep outputs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:29:15 +10:30
Rusty Russell
9544306f5b
Merge pull request #19 from braydonf/doc/install
...
doc: add install notes
2016-03-08 10:28: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
329f4f7dc2
Correct the formatting of HACKING.md; add top-level files reference.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 09:09:33 +10:30
Denis Gorbachev
8f18ca977b
Minor fixes
2016-01-22 09:09:33 +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
862509637b
daemon: implement unilateral commit.
...
This is only for the simple case where there are no HTLCs.
We group the current commit information together in the struct;
this involves a trivial transform from peer->cur_commit_theirsig to
peer->cur_commit.theirsig.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
27eedc9f51
patch bitcoind_get_mediantime.patch
2016-01-22 06:45:28 +10:30
Rusty Russell
6afe3f718d
daemon: bitcoind callback gives the blockhash the tx was included in.
...
This is required for transactions which use OP_CSV to lock outputs for
a given amount of time: we need to know the mediantime of the block
they were included into.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +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
4e5ced4de2
daemon: don't crash on pkt_err
...
We're about to test it, for anchor timeout.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
168ed96b12
daemon: close command.
...
This performs a mutual close.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
45c5c83d6f
daemon: exit main loop to free dead peers.
...
When a peer is finally to be freed (ie. STATE_CLOSED), doing this
inside the state logic is a bit fraught. We're better off exiting the
io loop and freeing it there.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
f690be1e83
daemon: dev-crash command.
...
Causes us to dump in crash.log.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
212f8ee022
daemon: fail if we enter an error state.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
b76858c1a1
daemon: implement HTLC expiry.
...
We do the simplest thing: a timer goes off, and we check all HTLCs for
one which has expired more than 30 seconds ago.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
1018823f97
daemon: HTLC expiry limits.
...
Don't accept an HTLC which is about to expire, nor one which will take
too long to expire.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
a3e3f83d9f
daemon: dev-mocktime command
...
Useful for precise timing control for testing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
f3c5aa7634
daemon: don't close conn until we've sent all the output packets.
...
Otherwise we won't finish the conversation. In fact, only the writer
side should ever close: we wake it if we want to close and it tests
peer->cond.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
8b666ea449
daemon: queue commands rather than executing them immediately.
...
When the only commands are via JSON, you might argue that we should
simply insist the user not operate on the same peer in parallel. That
would suck, and also we need to handle the case of a command from
a timer (eg. HTLC expiry!) or a bitcoin event.
So, we need a queue for commands, but also we need to do some of the
command checking just before the command runs: the HTLC we're dealing
with might have vanished for example.
The current command is wrapped in an anonymous "curr_cmd" struct
for extra clarity.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
2346f6bf14
daemon: routefail command.
...
This should be renamed: it's actually any kind of after-the-fact failure.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
86f4bd772c
daemon/test/test.sh: check_status() helper for HTLC status checks.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
1e82799852
daemon: fulfillhtlc command
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
17359279b2
daemon: getpeers: list HTLCs.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
e1f772a443
peer: implement committed_to_htlcs().
...
Simply count how many HTLCs are in our current funding state.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell
9efdbbb21b
peer: use funding.h's struct channel_htlc.
...
Instead of our own fields for the current htlc.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell
fc4c94cb06
daemon: simple close support for the case of one side closing transaction.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell
6ba5c3cc3b
timeout: oneshot timer support.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell
9f560a9494
daemon: --closing-fee
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell
6bdaa5d1ca
daemon: newhtlc command.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell
645958920e
peer: make_commit_txs() helper.
...
We need to call it in several places, so unify it into a single function.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell
5acb3c9848
daemon: dev-rhash command.
...
Useful for creating SHA256(r) from scripts.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell
8f0e10309a
daemon: --bitcoind-poll=<seconds>
...
Speeds up testing significantly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +10:30
Rusty Russell
6443629f6a
daemon/test/test.sh: add --valgrind and --gdb options.
...
We add a second to the sleep, as valgrind can be a little slow.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:27 +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
3c9fd4fbe6
daemon: code to open channel and watch anchor.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:05 +10:30