Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_bip68_sequence.py
Show First 20 Lines • Show All 382 Lines • ▼ Show 20 Lines | def test_sequence_lock_unconfirmed_inputs(self): | ||||
height = self.nodes[0].getblockcount() | height = self.nodes[0].getblockcount() | ||||
for i in range(2): | for i in range(2): | ||||
block = create_block(tip, create_coinbase(height), cur_time) | block = create_block(tip, create_coinbase(height), cur_time) | ||||
block.nVersion = 3 | block.nVersion = 3 | ||||
block.rehash() | block.rehash() | ||||
block.solve() | block.solve() | ||||
tip = block.sha256 | tip = block.sha256 | ||||
height += 1 | height += 1 | ||||
self.nodes[0].submitblock(ToHex(block)) | assert_equal( | ||||
None if i == 1 else 'inconclusive', | |||||
self.nodes[0].submitblock( | |||||
ToHex(block))) | |||||
cur_time += 1 | cur_time += 1 | ||||
mempool = self.nodes[0].getrawmempool() | mempool = self.nodes[0].getrawmempool() | ||||
assert tx3.hash not in mempool | assert tx3.hash not in mempool | ||||
assert tx2.hash in mempool | assert tx2.hash in mempool | ||||
# Reset the chain and get rid of the mocktimed-blocks | # Reset the chain and get rid of the mocktimed-blocks | ||||
self.nodes[0].setmocktime(0) | self.nodes[0].setmocktime(0) | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | def test_bip68_not_consensus(self): | ||||
tip, create_coinbase(self.nodes[0].getblockcount() + 1)) | tip, create_coinbase(self.nodes[0].getblockcount() + 1)) | ||||
block.nVersion = 3 | block.nVersion = 3 | ||||
block.vtx.extend( | block.vtx.extend( | ||||
sorted([tx1, tx2, tx3], key=lambda tx: tx.get_id())) | sorted([tx1, tx2, tx3], key=lambda tx: tx.get_id())) | ||||
block.hashMerkleRoot = block.calc_merkle_root() | block.hashMerkleRoot = block.calc_merkle_root() | ||||
block.rehash() | block.rehash() | ||||
block.solve() | block.solve() | ||||
self.nodes[0].submitblock(ToHex(block)) | assert_equal(None, self.nodes[0].submitblock(ToHex(block))) | ||||
assert_equal(self.nodes[0].getbestblockhash(), block.hash) | assert_equal(self.nodes[0].getbestblockhash(), block.hash) | ||||
def activateCSV(self): | def activateCSV(self): | ||||
# activation should happen at block height 576 | # activation should happen at block height 576 | ||||
csv_activation_height = 576 | csv_activation_height = 576 | ||||
height = self.nodes[0].getblockcount() | height = self.nodes[0].getblockcount() | ||||
assert_greater_than(csv_activation_height - height, 1) | assert_greater_than(csv_activation_height - height, 1) | ||||
self.nodes[0].generate(csv_activation_height - height - 1) | self.nodes[0].generate(csv_activation_height - height - 1) | ||||
Show All 25 Lines |