diff options
Diffstat (limited to 'blockpool/peers_test.go')
-rw-r--r-- | blockpool/peers_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/blockpool/peers_test.go b/blockpool/peers_test.go index 99dd16ba1..db83de43a 100644 --- a/blockpool/peers_test.go +++ b/blockpool/peers_test.go @@ -15,9 +15,9 @@ import ( func TestAddPeer(t *testing.T) { test.LogInit() _, blockPool, blockPoolTester := newTestBlockPool(t) - peer0 := blockPoolTester.newPeer("peer0", 1, 0) - peer1 := blockPoolTester.newPeer("peer1", 2, 1) - peer2 := blockPoolTester.newPeer("peer2", 3, 2) + peer0 := blockPoolTester.newPeer("peer0", 1, 1) + peer1 := blockPoolTester.newPeer("peer1", 2, 2) + peer2 := blockPoolTester.newPeer("peer2", 3, 3) var bestpeer *peer blockPool.Start() @@ -38,7 +38,7 @@ func TestAddPeer(t *testing.T) { if blockPool.peers.best.id != "peer2" { t.Errorf("peer2 (TD=3) not set as best") } - peer2.waitBlocksRequests(2) + peer2.waitBlocksRequests(3) best = peer1.AddPeer() if best { @@ -52,7 +52,7 @@ func TestAddPeer(t *testing.T) { } peer2.td = 4 - peer2.currentBlock = 3 + peer2.currentBlock = 4 best = peer2.AddPeer() if !best { t.Errorf("peer2 (TD=4) not accepted as best") @@ -63,10 +63,10 @@ func TestAddPeer(t *testing.T) { if blockPool.peers.best.td.Cmp(big.NewInt(int64(4))) != 0 { t.Errorf("peer2 TD not updated") } - peer2.waitBlocksRequests(3) + peer2.waitBlocksRequests(4) peer1.td = 3 - peer1.currentBlock = 2 + peer1.currentBlock = 3 best = peer1.AddPeer() if best { t.Errorf("peer1 (TD=3) should not be set as best") @@ -88,7 +88,7 @@ func TestAddPeer(t *testing.T) { if blockPool.peers.best.id != "peer1" { t.Errorf("existing peer1 (TD=3) should be set as best peer") } - peer1.waitBlocksRequests(2) + peer1.waitBlocksRequests(3) blockPool.RemovePeer("peer1") bestpeer, best = blockPool.peers.getPeer("peer1") @@ -99,7 +99,7 @@ func TestAddPeer(t *testing.T) { if blockPool.peers.best.id != "peer0" { t.Errorf("existing peer0 (TD=1) should be set as best peer") } - peer0.waitBlocksRequests(0) + peer0.waitBlocksRequests(1) blockPool.RemovePeer("peer0") bestpeer, best = blockPool.peers.getPeer("peer0") |