|
|
|
@ -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)
|
|
|
|
|