mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-25 21:39:05 +01:00
[logging] Don't log REJECT code when transaction is rejected
Remove the BIP61 REJECT code from error messages and logs when a
transaction is rejected.
BIP61 support was removed from Bitcoin Core in
fa25f43ac5. The REJECT codes will be
removed from the codebase entirely in the following commit.
This commit is contained in:
@@ -71,7 +71,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
node.generate(1)
|
||||
self.mempool_size = 0
|
||||
self.check_mempool_result(
|
||||
result_expected=[{'txid': txid_in_block, 'allowed': False, 'reject-reason': '18: txn-already-known'}],
|
||||
result_expected=[{'txid': txid_in_block, 'allowed': False, 'reject-reason': 'txn-already-known'}],
|
||||
rawtxs=[raw_tx_in_block],
|
||||
)
|
||||
|
||||
@@ -109,7 +109,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
node.sendrawtransaction(hexstring=raw_tx_0)
|
||||
self.mempool_size += 1
|
||||
self.check_mempool_result(
|
||||
result_expected=[{'txid': txid_0, 'allowed': False, 'reject-reason': '18: txn-already-in-mempool'}],
|
||||
result_expected=[{'txid': txid_0, 'allowed': False, 'reject-reason': 'txn-already-in-mempool'}],
|
||||
rawtxs=[raw_tx_0],
|
||||
)
|
||||
|
||||
@@ -133,7 +133,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
tx.vout[0].nValue -= int(4 * fee * COIN) # Set more fee
|
||||
# skip re-signing the tx
|
||||
self.check_mempool_result(
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '18: txn-mempool-conflict'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'txn-mempool-conflict'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
maxfeerate=0,
|
||||
)
|
||||
@@ -192,7 +192,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
# Skip re-signing the transaction for context independent checks from now on
|
||||
# tx.deserialize(BytesIO(hex_str_to_bytes(node.signrawtransactionwithwallet(tx.serialize().hex())['hex'])))
|
||||
self.check_mempool_result(
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-vout-empty'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bad-txns-vout-empty'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
|
||||
@@ -200,7 +200,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
||||
tx.vin = [tx.vin[0]] * math.ceil(MAX_BLOCK_BASE_SIZE / len(tx.vin[0].serialize()))
|
||||
self.check_mempool_result(
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-oversize'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bad-txns-oversize'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
|
||||
@@ -208,7 +208,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
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'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bad-txns-vout-negative'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
|
||||
@@ -217,7 +217,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
||||
tx.vout[0].nValue = 21000000 * COIN + 1
|
||||
self.check_mempool_result(
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-vout-toolarge'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bad-txns-vout-toolarge'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
|
||||
@@ -226,7 +226,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
tx.vout = [tx.vout[0]] * 2
|
||||
tx.vout[0].nValue = 21000000 * COIN
|
||||
self.check_mempool_result(
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-txouttotal-toolarge'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bad-txns-txouttotal-toolarge'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
|
||||
@@ -234,7 +234,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
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'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bad-txns-inputs-duplicate'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
|
||||
@@ -243,7 +243,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
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'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'coinbase'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
|
||||
@@ -251,19 +251,19 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
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'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'version'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
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'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'scriptpubkey'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
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'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'scriptsig-not-pushonly'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
||||
@@ -271,21 +271,21 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
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'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'tx-size'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
|
||||
tx.vout[0] = output_p2sh_burn
|
||||
tx.vout[0].nValue -= 1 # Make output smaller, such that it is dust for our policy
|
||||
self.check_mempool_result(
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: dust'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'dust'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
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'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'multi-op-return'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
|
||||
@@ -294,7 +294,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
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'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'non-final'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
)
|
||||
|
||||
@@ -303,7 +303,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
|
||||
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'}],
|
||||
result_expected=[{'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'non-BIP68-final'}],
|
||||
rawtxs=[tx.serialize().hex()],
|
||||
maxfeerate=0,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user