aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_block.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-01-13 18:40:29 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-01-13 18:42:24 +0100
commit807169e10b4a18324356ed6ee4d69587b96a7c70 (patch)
tree2c3d245eb97924ee21f83e0015745ce93ded057e /test/functional/feature_block.py
parent767ee2e3a1082468b4e2248bac3ef8bd54bb2ddb (diff)
parentaa8a65e4a88bfbd83ac756a87bfb8faf52fb675d (diff)
Merge bitcoin/bitcoin#24035: test: use MiniWallet for mempool_accept.py
aa8a65e4a88bfbd83ac756a87bfb8faf52fb675d test: use MiniWallet for mempool_accept.py (Sebastian Falbesoner) b24f6c6855bdd09bf445faeebe9d54c3d07a46d9 test: MiniWallet: support default `from_node` for creating txs (Sebastian Falbesoner) f30041c9143d0added18105c9f0c4ae3f340efbc test: create txs with current `nVersion` (2) by default (Sebastian Falbesoner) 2f7978682245ada40e7f72c6f28bf2379fdc8ce2 test: refactor: add constant for sequence number `SEQUENCE_FINAL` (Sebastian Falbesoner) Pull request description: This PR enables one more of the non-wallet functional tests (mempool_accept.py) to be run even with the Bitcoin Core wallet disabled by using the MiniWallet instead, as proposed in #20078. It also includes some other minor changes that came up while working on the replacement: * [commit 1/4] replace magic number 0xffffffff for a tx's nSequence with a new constant `SEQUENCE_FINAL` * [commit 2/4] create `CTransaction` instances with the current nVersion=2 by default, in order to use BIP68 for tests * [commit 3/4] support default `from_node` parameter for creating txs (this is a stripped down version of PR #24025) ACKs for top commit: MarcoFalke: re-ACK aa8a65e4a88bfbd83ac756a87bfb8faf52fb675d 📊 Tree-SHA512: 34cd085ea4147ad5bd3f3321c84204064ceb95f382664c7fe29062c1bbc79d9d9465c5e46d35e11c416f2f3cd46030c90a09b518c829c73ae40d060be5e4c9cb
Diffstat (limited to 'test/functional/feature_block.py')
-rwxr-xr-xtest/functional/feature_block.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py
index a3253763bd..462deeae32 100755
--- a/test/functional/feature_block.py
+++ b/test/functional/feature_block.py
@@ -23,6 +23,7 @@ from test_framework.messages import (
CTxIn,
CTxOut,
MAX_BLOCK_WEIGHT,
+ SEQUENCE_FINAL,
uint256_from_compact,
uint256_from_str,
)
@@ -50,9 +51,13 @@ from test_framework.script_util import (
script_to_p2sh_script,
)
from test_framework.test_framework import BitcoinTestFramework
-from test_framework.util import assert_equal
+from test_framework.util import (
+ assert_equal,
+ assert_greater_than,
+)
from data import invalid_txs
+
# Use this class for tests that require behavior other than normal p2p behavior.
# For now, it is used to serialize a bloated varint (b64).
class CBrokenBlock(CBlock):
@@ -801,7 +806,7 @@ class FullBlockTest(BitcoinTestFramework):
b58 = self.next_block(58, spend=out[17])
tx = CTransaction()
assert len(out[17].vout) < 42
- tx.vin.append(CTxIn(COutPoint(out[17].sha256, 42), CScript([OP_TRUE]), 0xffffffff))
+ tx.vin.append(CTxIn(COutPoint(out[17].sha256, 42), CScript([OP_TRUE]), SEQUENCE_FINAL))
tx.vout.append(CTxOut(0, b""))
tx.calc_sha256()
b58 = self.update_block(58, [tx])
@@ -876,7 +881,7 @@ class FullBlockTest(BitcoinTestFramework):
tx.nLockTime = 0xffffffff # this locktime is non-final
tx.vin.append(CTxIn(COutPoint(out[18].sha256, 0))) # don't set nSequence
tx.vout.append(CTxOut(0, CScript([OP_TRUE])))
- assert tx.vin[0].nSequence < 0xffffffff
+ assert_greater_than(SEQUENCE_FINAL, tx.vin[0].nSequence)
tx.calc_sha256()
b62 = self.update_block(62, [tx])
self.send_blocks([b62], success=False, reject_reason='bad-txns-nonfinal', reconnect=True)
@@ -1024,7 +1029,7 @@ class FullBlockTest(BitcoinTestFramework):
bogus_tx = CTransaction()
bogus_tx.sha256 = uint256_from_str(b"23c70ed7c0506e9178fc1a987f40a33946d4ad4c962b5ae3a52546da53af0c5c")
tx = CTransaction()
- tx.vin.append(CTxIn(COutPoint(bogus_tx.sha256, 0), b"", 0xffffffff))
+ tx.vin.append(CTxIn(COutPoint(bogus_tx.sha256, 0), b"", SEQUENCE_FINAL))
tx.vout.append(CTxOut(1, b""))
b70 = self.update_block(70, [tx])
self.send_blocks([b70], success=False, reject_reason='bad-txns-inputs-missingorspent', reconnect=True)