aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2020-08-25 09:46:05 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-03-31 21:09:59 +0200
commitdbc19814743cb12960a99793197c811e2750a06b (patch)
treebdc247a92f9642fb7c0c93886e372dd5afb1dad0
parent8d0ce50c4826529a2d30ffc850bce4d44da6019b (diff)
test: check that _all_ invalid-CLTV txs are allowed in a block pre-BIP65
-rwxr-xr-xtest/functional/feature_cltv.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/functional/feature_cltv.py b/test/functional/feature_cltv.py
index e2e6c5e600..c5b8e7ee6e 100755
--- a/test/functional/feature_cltv.py
+++ b/test/functional/feature_cltv.py
@@ -118,18 +118,22 @@ class BIP65Test(BitcoinTestFramework):
self.coinbase_txids = [self.nodes[0].getblock(b)['tx'][0] for b in self.nodes[0].generate(CLTV_HEIGHT - 2)]
self.nodeaddress = self.nodes[0].getnewaddress()
- self.log.info("Test that an invalid-according-to-CLTV transaction can still appear in a block")
+ self.log.info("Test that invalid-according-to-CLTV transactions can still appear in a block")
- spendtx = create_transaction(self.nodes[0], self.coinbase_txids[0],
- self.nodeaddress, amount=1.0)
- spendtx = cltv_invalidate(self.nodes[0], spendtx, 1)
- spendtx.rehash()
+ # create one invalid tx per CLTV failure reason (5 in total) and collect them
+ invalid_ctlv_txs = []
+ for i in range(5):
+ spendtx = create_transaction(self.nodes[0], self.coinbase_txids[i],
+ self.nodeaddress, amount=1.0)
+ spendtx = cltv_invalidate(self.nodes[0], spendtx, i)
+ spendtx.rehash()
+ invalid_ctlv_txs.append(spendtx)
tip = self.nodes[0].getbestblockhash()
block_time = self.nodes[0].getblockheader(tip)['mediantime'] + 1
block = create_block(int(tip, 16), create_coinbase(CLTV_HEIGHT - 1), block_time)
block.nVersion = 3
- block.vtx.append(spendtx)
+ block.vtx.extend(invalid_ctlv_txs)
block.hashMerkleRoot = block.calc_merkle_root()
block.solve()
@@ -153,7 +157,7 @@ class BIP65Test(BitcoinTestFramework):
self.log.info("Test that invalid-according-to-cltv transactions cannot appear in a block")
block.nVersion = 4
- spendtx = create_transaction(self.nodes[0], self.coinbase_txids[1],
+ spendtx = create_transaction(self.nodes[0], self.coinbase_txids[10],
self.nodeaddress, amount=1.0)
spendtx = cltv_invalidate(self.nodes[0], spendtx, 1)
spendtx.rehash()