Browse Source

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>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
4151537b71
  1. 4
      daemon/peer.c

4
daemon/peer.c

@ -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);

Loading…
Cancel
Save