daemon: batching of changes as per BOLT #2.

We now keep a list of commitment transaction states for "us" and
"them", as well as a "struct channel_state" for staged changes.

We manipulate these structures as we send out packets, receive
packets, or receive acknowledgement of packets.  In particular, we
update the other nodes' staging_cstate as we send out our requests,
and update our own staging_cstate are we receive acks.  When we
receive a request, we update both (as we immediately send out our
ack).

The RPC output is changed; rather than expose the complexity, we
expose our last committed state: what would happen if we have to drop
to the blockchain now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-03-31 17:13:20 +10:30
parent 017d199305
commit 5e7b3d02a1
12 changed files with 1318 additions and 1415 deletions

View File

@@ -252,6 +252,7 @@ static const struct json_command *cmdlist[] = {
&newhtlc_command,
&fulfillhtlc_command,
&failhtlc_command,
&commit_command,
&close_command,
/* Developer/debugging options. */
&echo_command,