diff options
author | Gleb Naumenko <naumenko.gs@gmail.com> | 2022-11-14 11:11:52 +0200 |
---|---|---|
committer | Gleb Naumenko <naumenko.gs@gmail.com> | 2022-11-14 11:40:15 +0200 |
commit | ac6ee5ba211d05869800497d6b518ea1ddd2c718 (patch) | |
tree | b02d0814084de4b1f52e2c0c8107fd212f8035e5 /src | |
parent | bc84e24a4f0736919ea4a76f7d45085587625aba (diff) |
test: Expand unit and functional tests for txreconciliation
Diffstat (limited to 'src')
-rw-r--r-- | src/test/txreconciliation_tests.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/test/txreconciliation_tests.cpp b/src/test/txreconciliation_tests.cpp index 1d6d4840c1..49317d12dc 100644 --- a/src/test/txreconciliation_tests.cpp +++ b/src/test/txreconciliation_tests.cpp @@ -22,17 +22,21 @@ BOOST_AUTO_TEST_CASE(RegisterPeerTest) BOOST_CHECK(tracker.RegisterPeer(/*peer_id=*/0, /*is_peer_inbound=*/true, /*peer_recon_version=*/0, salt) == ReconciliationRegisterResult::PROTOCOL_VIOLATION); - // Valid registration. + // Valid registration (inbound and outbound peers). BOOST_REQUIRE(!tracker.IsPeerRegistered(0)); BOOST_REQUIRE(tracker.RegisterPeer(0, true, 1, salt) == ReconciliationRegisterResult::SUCCESS); BOOST_CHECK(tracker.IsPeerRegistered(0)); - - // Reconciliation version is higher than ours, should be able to register. BOOST_REQUIRE(!tracker.IsPeerRegistered(1)); tracker.PreRegisterPeer(1); - BOOST_REQUIRE(tracker.RegisterPeer(1, true, 2, salt) == ReconciliationRegisterResult::SUCCESS); + BOOST_REQUIRE(tracker.RegisterPeer(1, false, 1, salt) == ReconciliationRegisterResult::SUCCESS); BOOST_CHECK(tracker.IsPeerRegistered(1)); + // Reconciliation version is higher than ours, should be able to register. + BOOST_REQUIRE(!tracker.IsPeerRegistered(2)); + tracker.PreRegisterPeer(2); + BOOST_REQUIRE(tracker.RegisterPeer(2, true, 2, salt) == ReconciliationRegisterResult::SUCCESS); + BOOST_CHECK(tracker.IsPeerRegistered(2)); + // Try registering for the second time. BOOST_REQUIRE(tracker.RegisterPeer(1, false, 1, salt) == ReconciliationRegisterResult::ALREADY_REGISTERED); |