From cbb120b1bb849c5f8098b007c59c6bb09f6361e4 Mon Sep 17 00:00:00 2001 From: Dimitrios Siganos Date: Sun, 25 Sep 2022 14:29:01 +0100 Subject: [PATCH] Bugfix: properly handle refused bootstrap connection (#3959) If we currently refuse a bootstrap connection we debug assert due to a missed return code check. This commit fixes that. --- nano/node/bootstrap/bootstrap_server.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nano/node/bootstrap/bootstrap_server.cpp b/nano/node/bootstrap/bootstrap_server.cpp index c429497b..57f45131 100644 --- a/nano/node/bootstrap/bootstrap_server.cpp +++ b/nano/node/bootstrap/bootstrap_server.cpp @@ -263,7 +263,11 @@ bool nano::bootstrap_server::process_message (std::unique_ptr mes if (allow_bootstrap) { // Switch to bootstrap connection mode and handle message in subsequent bootstrap visitor - to_bootstrap_connection (); + if (!to_bootstrap_connection ()) + { + stop (); + return false; + } } else { @@ -288,7 +292,7 @@ bool nano::bootstrap_server::process_message (std::unique_ptr mes } return true; } - // It is possible for server to switch to bootstrap mode immediately after processing handshake, thus no `else if` + // the server will switch to bootstrap mode immediately after processing the first bootstrap message, thus no `else if` if (is_bootstrap_connection ()) { bootstrap_message_visitor bootstrap_visitor{ shared_from_this () };