mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
peer: commit outstanding changes before sending PKT_CLOSE.
Pierre points out that we don't handle this, and it can happen due to race; the spec says we are not supposed to send PKT_CLOSE with uncommitted changes. Closes: #29 Reported-by: Pierre-Marie Padiou Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1529,6 +1529,10 @@ static bool peer_start_shutdown(struct peer *peer)
|
||||
enum state newstate;
|
||||
u8 *redeemscript;
|
||||
|
||||
/* We might have uncommited changes; if so, commit them now. */
|
||||
if (!do_commit(peer, NULL))
|
||||
return false;
|
||||
|
||||
db_start_transaction(peer);
|
||||
|
||||
db_begin_shutdown(peer);
|
||||
|
||||
Reference in New Issue
Block a user