2017-11-17 18:54:39 +01:00
|
|
|
#!/usr/bin/env python3
|
2019-02-21 02:03:13 +01:00
|
|
|
# Copyright (c) 2017-2019 The Bitcoin Core developers
|
2017-11-17 18:54:39 +01:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
"""Test mempool acceptance of raw transactions."""
|
|
|
|
|
|
|
|
from io import BytesIO
|
2018-11-27 18:54:05 +01:00
|
|
|
import math
|
2018-12-11 19:30:50 +01:00
|
|
|
|
2017-11-17 18:54:39 +01:00
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
|
|
from test_framework.messages import (
|
|
|
|
BIP125_SEQUENCE_NUMBER,
|
|
|
|
COIN,
|
|
|
|
COutPoint,
|
|
|
|
CTransaction,
|
|
|
|
CTxOut,
|
|
|
|
MAX_BLOCK_BASE_SIZE,
|
|
|
|
)
|
|
|
|
from test_framework.script import (
|
|
|
|
hash160,
|
|
|
|
CScript,
|
|
|
|
OP_0,
|
|
|
|
OP_EQUAL,
|
|
|
|
OP_HASH160,
|
|
|
|
OP_RETURN,
|
|
|
|
)
|
|
|
|
from test_framework.util import (
|
|
|
|
assert_equal,
|
|
|
|
assert_raises_rpc_error,
|
|
|
|
hex_str_to_bytes,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class MempoolAcceptanceTest(BitcoinTestFramework):
|
|
|
|
def set_test_params(self):
|
|
|
|
self.num_nodes = 1
|
2020-02-13 16:41:28 +01:00
|
|
|
self.extra_args = [[
|
|
|
|
'-permitbaremultisig=0',
|
|
|
|
]] * self.num_nodes
|
|
|
|
self.supports_cli = False
|
2017-11-17 18:54:39 +01:00
|
|
|
|
2018-09-09 19:32:37 +02:00
|
|
|
def skip_test_if_missing_module(self):
|
|
|
|
self.skip_if_no_wallet()
|
|
|
|
|
2017-11-17 18:54:39 +01:00
|
|
|
def check_mempool_result(self, result_expected, *args, **kwargs):
|
|
|
|
"""Wrapper to check result of testmempoolaccept on node_0's mempool"""
|
|
|
|
result_test = self.nodes[0].testmempoolaccept(*args, **kwargs)
|
|
|
|
assert_equal(result_expected, result_test)
|
|
|
|
assert_equal(self.nodes[0].getmempoolinfo()['size'], self.mempool_size) # Must not change mempool state
|
|
|
|
|
|
|
|
def run_test(self):
|
|
|
|
node = self.nodes[0]
|
|
|
|
|
|
|
|
self.log.info('Start with empty mempool, and 200 blocks')
|
|
|
|
self.mempool_size = 0
|
2019-02-11 19:56:19 +01:00
|
|
|
assert_equal(node.getblockcount(), 200)
|
2017-11-17 18:54:39 +01:00
|
|
|
assert_equal(node.getmempoolinfo()['size'], self.mempool_size)
|
2018-12-15 00:16:06 +01:00
|
|
|
coins = node.listunspent()
|
2017-11-17 18:54:39 +01:00
|
|
|
|
|
|
|
self.log.info('Should not accept garbage to testmempoolaccept')
|
|
|
|
assert_raises_rpc_error(-3, 'Expected type array, got string', lambda: node.testmempoolaccept(rawtxs='ff00baar'))
|
|
|
|
assert_raises_rpc_error(-8, 'Array must contain exactly one raw transaction for now', lambda: node.testmempoolaccept(rawtxs=['ff00baar', 'ff22']))
|
|
|
|
assert_raises_rpc_error(-22, 'TX decode failed', lambda: node.testmempoolaccept(rawtxs=['ff00baar']))
|
|
|
|
|
|
|
|
self.log.info('A transaction already in the blockchain')
|
2018-12-15 00:16:06 +01:00
|
|
|
coin = coins.pop() # Pick a random coin(base) to spend
|
2017-11-17 18:54:39 +01:00
|
|
|
raw_tx_in_block = node.signrawtransactionwithwallet(node.createrawtransaction(
|
|
|
|
inputs=[{'txid': coin['txid'], 'vout': coin['vout']}],
|
2020-02-13 16:41:28 +01:00
|
|
|
outputs=[{node.getnewaddress(): 0.1}, {node.getnewaddress(): 0.8}],
|
2017-11-17 18:54:39 +01:00
|
|
|
))['hex']
|
2018-06-27 10:21:07 +02:00
|
|
|
txid_in_block = node.sendrawtransaction(hexstring=raw_tx_in_block, maxfeerate=0)
|
2017-11-17 18:54:39 +01:00
|
|
|
node.generate(1)
|
2018-12-11 19:30:50 +01:00
|
|
|
self.mempool_size = 0
|
2020-02-18 07:36:43 +01:00
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': txid_in_block, 'allowed': False, 'reject-reason': '18: txn-already-known'}],
|
|
|
|
rawtxs=[raw_tx_in_block],
|
|
|
|
)
|
2017-11-17 18:54:39 +01:00
|
|
|
|
|
|
|
self.log.info('A transaction not in the mempool')
|
2020-02-13 16:41:28 +01:00
|
|
|
fee = 0.00000700
|
2017-11-17 18:54:39 +01:00
|
|
|
raw_tx_0 = node.signrawtransactionwithwallet(node.createrawtransaction(
|
|
|
|
inputs=[{"txid": txid_in_block, "vout": 0, "sequence": BIP125_SEQUENCE_NUMBER}], # RBF is used later
|
2020-02-13 16:41:28 +01:00
|
|
|
outputs=[{node.getnewaddress(): 0.09 - fee}],
|
2017-11-17 18:54:39 +01:00
|
|
|
))['hex']
|
|
|
|
tx = CTransaction()
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_0)))
|
|
|
|
txid_0 = tx.rehash()
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': txid_0, 'allowed': True}],
|
|
|
|
rawtxs=[raw_tx_0],
|
|
|
|
)
|
|
|
|
|
2018-12-11 19:30:50 +01:00
|
|
|
self.log.info('A final transaction not in the mempool')
|
2018-12-15 00:16:06 +01:00
|
|
|
coin = coins.pop() # Pick a random coin(base) to spend
|
2018-12-11 19:30:50 +01:00
|
|
|
raw_tx_final = node.signrawtransactionwithwallet(node.createrawtransaction(
|
|
|
|
inputs=[{'txid': coin['txid'], 'vout': coin['vout'], "sequence": 0xffffffff}], # SEQUENCE_FINAL
|
|
|
|
outputs=[{node.getnewaddress(): 0.025}],
|
|
|
|
locktime=node.getblockcount() + 2000, # Can be anything
|
|
|
|
))['hex']
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_final)))
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': True}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2018-06-27 10:21:07 +02:00
|
|
|
maxfeerate=0,
|
2018-12-11 19:30:50 +01:00
|
|
|
)
|
2018-06-27 10:21:07 +02:00
|
|
|
node.sendrawtransaction(hexstring=raw_tx_final, maxfeerate=0)
|
2018-12-11 19:30:50 +01:00
|
|
|
self.mempool_size += 1
|
|
|
|
|
2017-11-17 18:54:39 +01:00
|
|
|
self.log.info('A transaction in the mempool')
|
|
|
|
node.sendrawtransaction(hexstring=raw_tx_0)
|
2018-12-11 19:30:50 +01:00
|
|
|
self.mempool_size += 1
|
2017-11-17 18:54:39 +01:00
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': txid_0, 'allowed': False, 'reject-reason': '18: txn-already-in-mempool'}],
|
|
|
|
rawtxs=[raw_tx_0],
|
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A transaction that replaces a mempool transaction')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_0)))
|
|
|
|
tx.vout[0].nValue -= int(fee * COIN) # Double the fee
|
|
|
|
tx.vin[0].nSequence = BIP125_SEQUENCE_NUMBER + 1 # Now, opt out of RBF
|
2019-02-18 16:35:48 +01:00
|
|
|
raw_tx_0 = node.signrawtransactionwithwallet(tx.serialize().hex())['hex']
|
2017-11-17 18:54:39 +01:00
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_0)))
|
|
|
|
txid_0 = tx.rehash()
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': txid_0, 'allowed': True}],
|
|
|
|
rawtxs=[raw_tx_0],
|
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A transaction that conflicts with an unconfirmed tx')
|
|
|
|
# Send the transaction that replaces the mempool transaction and opts out of replaceability
|
2018-06-27 10:21:07 +02:00
|
|
|
node.sendrawtransaction(hexstring=tx.serialize().hex(), maxfeerate=0)
|
2017-11-17 18:54:39 +01:00
|
|
|
# take original raw_tx_0
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_0)))
|
2019-09-19 16:31:07 +02:00
|
|
|
tx.vout[0].nValue -= int(0.08 * fee * COIN) # Set more fee
|
2017-11-17 18:54:39 +01:00
|
|
|
# skip re-signing the tx
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '18: txn-mempool-conflict'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2018-06-27 10:21:07 +02:00
|
|
|
maxfeerate=0,
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A transaction with missing inputs, that never existed')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_0)))
|
|
|
|
tx.vin[0].prevout = COutPoint(hash=int('ff' * 32, 16), n=14)
|
|
|
|
# skip re-signing the tx
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'missing-inputs'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A transaction with missing inputs, that existed once in the past')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_0)))
|
|
|
|
tx.vin[0].prevout.n = 1 # Set vout to 1, to spend the other outpoint (49 coins) of the in-chain-tx we want to double spend
|
2019-02-18 16:35:48 +01:00
|
|
|
raw_tx_1 = node.signrawtransactionwithwallet(tx.serialize().hex())['hex']
|
2018-06-27 10:21:07 +02:00
|
|
|
txid_1 = node.sendrawtransaction(hexstring=raw_tx_1, maxfeerate=0)
|
2017-11-17 18:54:39 +01:00
|
|
|
# Now spend both to "clearly hide" the outputs, ie. remove the coins from the utxo set by spending them
|
|
|
|
raw_tx_spend_both = node.signrawtransactionwithwallet(node.createrawtransaction(
|
|
|
|
inputs=[
|
|
|
|
{'txid': txid_0, 'vout': 0},
|
|
|
|
{'txid': txid_1, 'vout': 0},
|
|
|
|
],
|
|
|
|
outputs=[{node.getnewaddress(): 0.1}]
|
|
|
|
))['hex']
|
2018-06-27 10:21:07 +02:00
|
|
|
txid_spend_both = node.sendrawtransaction(hexstring=raw_tx_spend_both, maxfeerate=0)
|
2017-11-17 18:54:39 +01:00
|
|
|
node.generate(1)
|
|
|
|
self.mempool_size = 0
|
|
|
|
# Now see if we can add the coins back to the utxo set by sending the exact txs again
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': txid_0, 'allowed': False, 'reject-reason': 'missing-inputs'}],
|
|
|
|
rawtxs=[raw_tx_0],
|
|
|
|
)
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': txid_1, 'allowed': False, 'reject-reason': 'missing-inputs'}],
|
|
|
|
rawtxs=[raw_tx_1],
|
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('Create a signed "reference" tx for later use')
|
|
|
|
raw_tx_reference = node.signrawtransactionwithwallet(node.createrawtransaction(
|
|
|
|
inputs=[{'txid': txid_spend_both, 'vout': 0}],
|
|
|
|
outputs=[{node.getnewaddress(): 0.05}],
|
|
|
|
))['hex']
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
# Reference tx should be valid on itself
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': True}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2019-08-01 19:03:01 +02:00
|
|
|
maxfeerate=0,
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A transaction with no outputs')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.vout = []
|
|
|
|
# Skip re-signing the transaction for context independent checks from now on
|
2019-02-18 16:35:48 +01:00
|
|
|
# tx.deserialize(BytesIO(hex_str_to_bytes(node.signrawtransactionwithwallet(tx.serialize().hex())['hex'])))
|
2017-11-17 18:54:39 +01:00
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-vout-empty'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A really large transaction')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
2018-11-27 18:54:05 +01:00
|
|
|
tx.vin = [tx.vin[0]] * math.ceil(MAX_BLOCK_BASE_SIZE / len(tx.vin[0].serialize()))
|
2017-11-17 18:54:39 +01:00
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-oversize'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A transaction with negative output value')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.vout[0].nValue *= -1
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-vout-negative'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
2018-11-10 18:11:22 +01:00
|
|
|
# The following two validations prevent overflow of the output amounts (see CVE-2010-5139).
|
2017-11-17 18:54:39 +01:00
|
|
|
self.log.info('A transaction with too large output value')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
2020-02-13 16:41:28 +01:00
|
|
|
tx.vout[0].nValue = 21000000000 * COIN + 1
|
2017-11-17 18:54:39 +01:00
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-vout-toolarge'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A transaction with too large sum of output values')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.vout = [tx.vout[0]] * 2
|
2020-02-13 16:41:28 +01:00
|
|
|
tx.vout[0].nValue = 21000000000 * COIN
|
2017-11-17 18:54:39 +01:00
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-txouttotal-toolarge'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A transaction with duplicate inputs')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.vin = [tx.vin[0]] * 2
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-inputs-duplicate'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A coinbase transaction')
|
|
|
|
# Pick the input of the first tx we signed, so it has to be a coinbase tx
|
|
|
|
raw_tx_coinbase_spent = node.getrawtransaction(txid=node.decoderawtransaction(hexstring=raw_tx_in_block)['vin'][0]['txid'])
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_coinbase_spent)))
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: coinbase'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('Some nonstandard transactions')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.nVersion = 3 # A version currently non-standard
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: version'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.vout[0].scriptPubKey = CScript([OP_0]) # Some non-standard script
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: scriptpubkey'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.vin[0].scriptSig = CScript([OP_HASH160]) # Some not-pushonly scriptSig
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: scriptsig-not-pushonly'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
output_p2sh_burn = CTxOut(nValue=540, scriptPubKey=CScript([OP_HASH160, hash160(b'burn'), OP_EQUAL]))
|
|
|
|
num_scripts = 100000 // len(output_p2sh_burn.serialize()) # Use enough outputs to make the tx too large for our policy
|
|
|
|
tx.vout = [output_p2sh_burn] * num_scripts
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: tx-size'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.vout[0] = output_p2sh_burn
|
2020-02-13 16:41:28 +01:00
|
|
|
tx.vout[0].nValue = 1 # Make output smaller, such that it is dust for our policy
|
2017-11-17 18:54:39 +01:00
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: dust'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.vout[0].scriptPubKey = CScript([OP_RETURN, b'\xff'])
|
|
|
|
tx.vout = [tx.vout[0]] * 2
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: multi-op-return'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A timelocked transaction')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.vin[0].nSequence -= 1 # Should be non-max, so locktime is not ignored
|
|
|
|
tx.nLockTime = node.getblockcount() + 1
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: non-final'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
self.log.info('A transaction that is locked by BIP68 sequence logic')
|
|
|
|
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
|
|
|
tx.vin[0].nSequence = 2 # We could include it in the second block mined from now, but not the very next one
|
|
|
|
# Can skip re-signing the tx because of early rejection
|
|
|
|
self.check_mempool_result(
|
|
|
|
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: non-BIP68-final'}],
|
2019-02-18 16:35:48 +01:00
|
|
|
rawtxs=[tx.serialize().hex()],
|
2018-06-27 10:21:07 +02:00
|
|
|
maxfeerate=0,
|
2017-11-17 18:54:39 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
MempoolAcceptanceTest().main()
|