mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
peer: don't ever fail twice.
There are paths where this can happen (eg. db fail), but don't call peer_breakdown() twice. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -383,6 +383,10 @@ static struct io_plan *peer_close(struct io_conn *conn, struct peer *peer)
|
||||
|
||||
void peer_fail(struct peer *peer, const char *caller)
|
||||
{
|
||||
/* Don't fail twice. */
|
||||
if (state_is_error(peer->state) || state_is_onchain(peer->state))
|
||||
return;
|
||||
|
||||
/* FIXME: Save state here? */
|
||||
set_peer_state(peer, STATE_ERR_BREAKDOWN, caller, false);
|
||||
peer_breakdown(peer);
|
||||
|
||||
Reference in New Issue
Block a user