diff --git a/src/avalanche/processor.h b/src/avalanche/processor.h --- a/src/avalanche/processor.h +++ b/src/avalanche/processor.h @@ -258,7 +258,7 @@ bool registerVotes(NodeId nodeid, const Response &response, std::vector &updates); - bool addPeer(NodeId nodeid, const Proof &proof, const CPubKey &pubkey); + bool addNode(NodeId nodeid, const Proof &proof, const CPubKey &pubkey); bool forNode(NodeId nodeid, std::function func) const; CPubKey getSessionPubKey() const { return sessionKey.GetPubKey(); } diff --git a/src/avalanche/processor.cpp b/src/avalanche/processor.cpp --- a/src/avalanche/processor.cpp +++ b/src/avalanche/processor.cpp @@ -333,7 +333,7 @@ return true; } -bool Processor::addPeer(NodeId nodeid, const Proof &proof, +bool Processor::addNode(NodeId nodeid, const Proof &proof, const CPubKey &pubkey) { LOCK(cs_peerManager); return peerManager->addNode(nodeid, proof, pubkey); diff --git a/src/avalanche/test/processor_tests.cpp b/src/avalanche/test/processor_tests.cpp --- a/src/avalanche/test/processor_tests.cpp +++ b/src/avalanche/test/processor_tests.cpp @@ -530,7 +530,7 @@ auto avanode = ConnectNode(config, NODE_AVALANCHE, *peerLogic, connman.get()); NodeId avanodeid = avanode->GetId(); - BOOST_CHECK(p.addPeer(avanodeid, Proof::makeRandom(100), CPubKey())); + BOOST_CHECK(p.addNode(avanodeid, Proof::makeRandom(100), CPubKey())); // It returns the avalanche peer. BOOST_CHECK_EQUAL(AvalancheTest::getSuitableNodeToQuery(p), avanodeid); @@ -677,7 +677,7 @@ auto avanode = ConnectNode(config, NODE_AVALANCHE, *peerLogic, connman.get()); NodeId avanodeid = avanode->GetId(); - BOOST_CHECK(p.addPeer(avanodeid, Proof::makeRandom(100), CPubKey())); + BOOST_CHECK(p.addNode(avanodeid, Proof::makeRandom(100), CPubKey())); // Expire requests after some time. auto queryTimeDuration = std::chrono::milliseconds(10); @@ -891,7 +891,7 @@ auto avanode = ConnectNode(config, NODE_AVALANCHE, *peerLogic, connman.get()); NodeId nodeid = avanode->GetId(); - BOOST_CHECK(p.addPeer(nodeid, Proof::makeRandom(100), CPubKey())); + BOOST_CHECK(p.addNode(nodeid, Proof::makeRandom(100), CPubKey())); // There is no query in flight at the moment. BOOST_CHECK_EQUAL(AvalancheTest::getSuitableNodeToQuery(p), nodeid); diff --git a/src/rpc/avalanche.cpp b/src/rpc/avalanche.cpp --- a/src/rpc/avalanche.cpp +++ b/src/rpc/avalanche.cpp @@ -43,7 +43,8 @@ {"proof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Proof that the node is not a sybil."}, }, - RPCResults{}, + RPCResult{"\"success\" (boolean) Whether the addition succeeded or " + "not.\n"}, RPCExamples{ HelpExampleRpc("addavalanchenode", "5, \"\", \"\"")}, } @@ -72,8 +73,7 @@ avalanche::Proof proof; ss >> proof; - g_avalanche->addPeer(nodeid, proof, {HexToPubKey(keyHex)}); - return {}; + return g_avalanche->addNode(nodeid, proof, {HexToPubKey(keyHex)}); } // clang-format off diff --git a/test/functional/abc_p2p_avalanche.py b/test/functional/abc_p2p_avalanche.py --- a/test/functional/abc_p2p_avalanche.py +++ b/test/functional/abc_p2p_avalanche.py @@ -193,7 +193,9 @@ # Activate the quorum. for n in quorum: - node.addavalanchenode(n.nodeid, pubkey.hex(), AVA_HEX_PROOF) + success = node.addavalanchenode( + n.nodeid, pubkey.hex(), AVA_HEX_PROOF) + assert success is True def can_find_block_in_poll(hash, resp=BLOCK_ACCEPTED): found_hash = False