@@ -22,17 +22,21 @@ BOOST_AUTO_TEST_CASE(RegisterPeerTest)
22
22
BOOST_CHECK (tracker.RegisterPeer (/* peer_id=*/ 0 , /* is_peer_inbound=*/ true ,
23
23
/* peer_recon_version=*/ 0 , salt) == ReconciliationRegisterResult::PROTOCOL_VIOLATION);
24
24
25
- // Valid registration.
25
+ // Valid registration (inbound and outbound peers) .
26
26
BOOST_REQUIRE (!tracker.IsPeerRegistered (0 ));
27
27
BOOST_REQUIRE (tracker.RegisterPeer (0 , true , 1 , salt) == ReconciliationRegisterResult::SUCCESS);
28
28
BOOST_CHECK (tracker.IsPeerRegistered (0 ));
29
-
30
- // Reconciliation version is higher than ours, should be able to register.
31
29
BOOST_REQUIRE (!tracker.IsPeerRegistered (1 ));
32
30
tracker.PreRegisterPeer (1 );
33
- BOOST_REQUIRE (tracker.RegisterPeer (1 , true , 2 , salt) == ReconciliationRegisterResult::SUCCESS);
31
+ BOOST_REQUIRE (tracker.RegisterPeer (1 , false , 1 , salt) == ReconciliationRegisterResult::SUCCESS);
34
32
BOOST_CHECK (tracker.IsPeerRegistered (1 ));
35
33
34
+ // Reconciliation version is higher than ours, should be able to register.
35
+ BOOST_REQUIRE (!tracker.IsPeerRegistered (2 ));
36
+ tracker.PreRegisterPeer (2 );
37
+ BOOST_REQUIRE (tracker.RegisterPeer (2 , true , 2 , salt) == ReconciliationRegisterResult::SUCCESS);
38
+ BOOST_CHECK (tracker.IsPeerRegistered (2 ));
39
+
36
40
// Try registering for the second time.
37
41
BOOST_REQUIRE (tracker.RegisterPeer (1 , false , 1 , salt) == ReconciliationRegisterResult::ALREADY_REGISTERED);
38
42
0 commit comments