Skip to content

Commit 5e7b3d0

Browse files
committed
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>
1 parent 017d199 commit 5e7b3d0

File tree

12 files changed

+1257
-1354
lines changed

12 files changed

+1257
-1354
lines changed

daemon/jsonrpc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ static const struct json_command *cmdlist[] = {
252252
&newhtlc_command,
253253
&fulfillhtlc_command,
254254
&failhtlc_command,
255+
&commit_command,
255256
&close_command,
256257
/* Developer/debugging options. */
257258
&echo_command,

daemon/jsonrpc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ extern const struct json_command getpeers_command;
6161
extern const struct json_command newhtlc_command;
6262
extern const struct json_command fulfillhtlc_command;
6363
extern const struct json_command failhtlc_command;
64+
extern const struct json_command commit_command;
6465
extern const struct json_command mocktime_command;
6566
extern const struct json_command close_command;
6667
#endif /* LIGHTNING_DAEMON_JSONRPC_H */

0 commit comments

Comments
 (0)