Skip to content

Commit 547fbec

Browse files
committed
fix: intermittent error in p2p_invalid_block.py
Mocktime here is misused here `t = int(time.time())` Functional test p2p_invalid_block.py is changed are adjusted for Dash Core
1 parent 4930ee6 commit 547fbec

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

test/functional/p2p_invalid_block.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,14 @@ def run_test(self):
132132
peer.send_blocks_and_test([block4], node, success=False, reject_reason='bad-txns-inputs-duplicate')
133133

134134
self.log.info("Test accepting identical block after rejecting it due to a future timestamp.")
135-
t = int(time.time())
136-
node.setmocktime(t)
135+
t = self.mocktime
137136
# Set block time +1 second past max future validity
138137
block = create_block(tip, create_coinbase(height), t + MAX_FUTURE_BLOCK_TIME + 1)
139138
block.hashMerkleRoot = block.calc_merkle_root()
140139
block.solve()
141140
# Need force_send because the block will get rejected without a getdata otherwise
142141
peer.send_blocks_and_test([block], node, force_send=True, success=False, reject_reason='time-too-new')
143-
node.setmocktime(t + 1)
142+
self.bump_mocktime(1)
144143
peer.send_blocks_and_test([block], node, success=True)
145144

146145

0 commit comments

Comments
 (0)