Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_bip68_sequence.py
Show First 20 Lines • Show All 302 Lines • ▼ Show 20 Lines | def test_sequence_lock_unconfirmed_inputs(self): | ||||
test_nonzero_locks( | test_nonzero_locks( | ||||
tx2, self.nodes[0], use_height_lock=True) | tx2, self.nodes[0], use_height_lock=True) | ||||
test_nonzero_locks( | test_nonzero_locks( | ||||
tx2, self.nodes[0], use_height_lock=False) | tx2, self.nodes[0], use_height_lock=False) | ||||
# Now mine some blocks, but make sure tx2 doesn't get mined. | # Now mine some blocks, but make sure tx2 doesn't get mined. | ||||
# Use prioritisetransaction to lower the effective feerate to 0 | # Use prioritisetransaction to lower the effective feerate to 0 | ||||
self.nodes[0].prioritisetransaction( | self.nodes[0].prioritisetransaction( | ||||
tx2.hash, -1e15, -fee_multiplier * self.nodes[0].calculate_fee(tx2)) | tx2.hash, -fee_multiplier * self.nodes[0].calculate_fee(tx2)) | ||||
cur_time = int(time.time()) | cur_time = int(time.time()) | ||||
for i in range(10): | for i in range(10): | ||||
self.nodes[0].setmocktime(cur_time + 600) | self.nodes[0].setmocktime(cur_time + 600) | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
cur_time += 600 | cur_time += 600 | ||||
assert tx2.hash in self.nodes[0].getrawmempool() | assert tx2.hash in self.nodes[0].getrawmempool() | ||||
test_nonzero_locks( | test_nonzero_locks( | ||||
tx2, self.nodes[0], use_height_lock=True) | tx2, self.nodes[0], use_height_lock=True) | ||||
test_nonzero_locks( | test_nonzero_locks( | ||||
tx2, self.nodes[0], use_height_lock=False) | tx2, self.nodes[0], use_height_lock=False) | ||||
# Mine tx2, and then try again | # Mine tx2, and then try again | ||||
self.nodes[0].prioritisetransaction( | self.nodes[0].prioritisetransaction( | ||||
tx2.hash, 1e15, fee_multiplier * self.nodes[0].calculate_fee(tx2)) | tx2.hash, fee_multiplier * self.nodes[0].calculate_fee(tx2)) | ||||
# Advance the time on the node so that we can test timelocks | # Advance the time on the node so that we can test timelocks | ||||
self.nodes[0].setmocktime(cur_time + 600) | self.nodes[0].setmocktime(cur_time + 600) | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
assert tx2.hash not in self.nodes[0].getrawmempool() | assert tx2.hash not in self.nodes[0].getrawmempool() | ||||
# Now that tx2 is not in the mempool, a sequence locked spend should | # Now that tx2 is not in the mempool, a sequence locked spend should | ||||
# succeed | # succeed | ||||
▲ Show 20 Lines • Show All 160 Lines • Show Last 20 Lines |