peer: add flag to indicate whether we created anchor.

Useful for database.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-08-18 14:25:13 +09:30
parent f4fe42e977
commit ab2fac3714
2 changed files with 5 additions and 0 deletions

View file

@ -142,6 +142,9 @@ struct peer {
/* Depth to trigger anchor if still opening, or -1. */
int ok_depth;
/* Did we create anchor? */
bool ours;
} anchor;
struct {

View file

@ -104,6 +104,7 @@ enum state state(struct peer *peer,
goto err_breakdown;
}
bitcoin_create_anchor(peer);
peer->anchor.ours = true;
/* This shouldn't happen! */
if (!setup_first_commit(peer)) {
@ -128,6 +129,7 @@ enum state state(struct peer *peer,
goto err_breakdown;
}
peer->anchor.ours = false;
if (!setup_first_commit(peer)) {
err = pkt_err(peer, "Insufficient funds for fee");
peer_open_complete(peer, err->error->problem);