mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
peer: do not send anchor depth input twice.
We *should* be in a state which accepts it (could happen with reorg), and there's no reason to test for greater than depth since we must process blocks in order. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
7b5806fef2
commit
dff50c3a5f
@ -2960,8 +2960,8 @@ static enum watch_result anchor_depthchange(struct peer *peer,
|
||||
void *unused)
|
||||
{
|
||||
/* Still waiting for it to reach depth? */
|
||||
if (state_is_opening(peer->state)) {
|
||||
if ((int)depth >= peer->anchor.ok_depth) {
|
||||
if (state_is_waiting_for_anchor(peer->state)) {
|
||||
if ((int)depth == peer->anchor.ok_depth) {
|
||||
state_event(peer, BITCOIN_ANCHOR_DEPTHOK, NULL);
|
||||
peer->anchor.ok_depth = -1;
|
||||
}
|
||||
|
8
state.h
8
state.h
@ -40,6 +40,14 @@ static inline bool state_is_opening(enum state s)
|
||||
return s < STATE_NORMAL;
|
||||
}
|
||||
|
||||
static inline bool state_is_waiting_for_anchor(enum state s)
|
||||
{
|
||||
return s == STATE_OPEN_WAITING_OURANCHOR
|
||||
|| s == STATE_OPEN_WAITING_OURANCHOR_THEYCOMPLETED
|
||||
|| s == STATE_OPEN_WAITING_THEIRANCHOR
|
||||
|| s == STATE_OPEN_WAITING_THEIRANCHOR_THEYCOMPLETED;
|
||||
}
|
||||
|
||||
static inline bool state_can_io(enum state s)
|
||||
{
|
||||
if (state_is_error(s))
|
||||
|
Loading…
Reference in New Issue
Block a user