mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 09:50:08 +01:00
Fix failing test case because of wrong TimeOffset
This commit is contained in:
parent
cb71f278ec
commit
21d11e2809
@ -151,8 +151,11 @@ func testPeer(t *testing.T, p *peer.Peer, s peerStats) {
|
||||
return
|
||||
}
|
||||
|
||||
if p.TimeOffset() != s.wantTimeOffset {
|
||||
t.Errorf("testPeer: wrong TimeOffset - got %v, want %v", p.TimeOffset(), s.wantTimeOffset)
|
||||
// Allow for a deviation of 1s, as the second may tick when the message is
|
||||
// in transit and the protocol doesn't support any further precision.
|
||||
if p.TimeOffset() != s.wantTimeOffset && p.TimeOffset() != s.wantTimeOffset-1 {
|
||||
t.Errorf("testPeer: wrong TimeOffset - got %v, want %v or %v", p.TimeOffset(),
|
||||
s.wantTimeOffset, s.wantTimeOffset-1)
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user