Skip to content

Commit bad3243

Browse files
Bump mocktime before generating new blocks and generate a few blocks at the end of test_mempool_doublespend in p2p-instantsend.py (#3125)
* Cleanup p2p-instantsend.py Bump mocktime before generating new blocks and generate a few blocks at the end of test_mempool_doublespend to clean things up * Update test/functional/p2p-instantsend.py Co-Authored-By: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
1 parent 82ebba1 commit bad3243

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/functional/p2p-instantsend.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
assert_raises_rpc_error
1010

1111
'''
12-
InstantSendTest -- test InstantSend functionality (prevent doublespend for unconfirmed transactions)
12+
p2p-instantsend.py
13+
14+
Tests InstantSend functionality (prevent doublespend for unconfirmed transactions)
1315
'''
1416

1517
class InstantSendTest(DashTestFramework):
@@ -40,6 +42,8 @@ def test_block_doublespend(self):
4042
# feed the sender with some balance
4143
sender_addr = sender.getnewaddress()
4244
self.nodes[0].sendtoaddress(sender_addr, 1)
45+
self.bump_mocktime(1)
46+
set_node_times(self.nodes, self.mocktime)
4347
self.nodes[0].generate(2)
4448
self.sync_all()
4549

@@ -92,6 +96,8 @@ def test_mempool_doublespend(self):
9296
# feed the sender with some balance
9397
sender_addr = sender.getnewaddress()
9498
self.nodes[0].sendtoaddress(sender_addr, 1)
99+
self.bump_mocktime(1)
100+
set_node_times(self.nodes, self.mocktime)
95101
self.nodes[0].generate(2)
96102
self.sync_all()
97103

@@ -120,6 +126,11 @@ def test_mempool_doublespend(self):
120126
# send coins back to the controller node without waiting for confirmations
121127
receiver.sendtoaddress(self.nodes[0].getnewaddress(), 0.9, "", "", True)
122128
assert_equal(receiver.getwalletinfo()["balance"], 0)
129+
# mine more blocks
130+
self.bump_mocktime(1)
131+
set_node_times(self.nodes, self.mocktime)
132+
self.nodes[0].generate(2)
133+
self.sync_all()
123134

124135
if __name__ == '__main__':
125136
InstantSendTest().main()

0 commit comments

Comments
 (0)