Rusty Russell
85147347e2
funding: explicitly mark which side offered the anchor.
...
The channel funding code needs to know who offered the anchor, as they
are responsible for paying fees until the other side is able to. This
is actually a hack, but at least now it's internal to funding and not
passed in at every funding_delta() call.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-15 17:07:30 +10:30
Rusty Russell
cb0cc80984
patch remove-timeout.patch
2016-03-15 17:07:12 +10:30
Rusty Russell
1f9103c9d3
daemon: rename num_htlcs to commit_tx_counter.
...
Much clearer name.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:43:15 +10:30
Rusty Russell
983000428f
daemon: rename CMD_SEND_HTLC_UPDATE to CMD_SEND_HTLC_ADD
...
There are other updates than just adding an HTLC; make this explicit.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-03-08 10:42:15 +10:30
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
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
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
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
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
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
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
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
1e82799852
daemon: fulfillhtlc command
...
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
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
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
Rusty Russell
ecbe671688
peer: keep current commit txs, anchor state, channel funding and their sig.
...
This lets us implement accept_pkt_anchor().
Also had to predeclare sha256 in commit_tx.h, revealed by the new
includes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:44:27 +10:30
Rusty Russell
12b9d39b76
daemon: store revocation hashes in the peer_visible_state structure.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:44:24 +10:30
Rusty Russell
abc002ff15
daemon: add state.c.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:44:13 +10:30