diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1142,8 +1142,7 @@ result_0.pushKV("reject-reason", "missing-inputs"); } else { result_0.pushKV("reject-reason", - strprintf("%i: %s", state.GetRejectCode(), - state.GetRejectReason())); + strprintf("%s", state.GetRejectReason())); } } else { result_0.pushKV("reject-reason", state.GetRejectReason()); diff --git a/src/util/validation.cpp b/src/util/validation.cpp --- a/src/util/validation.cpp +++ b/src/util/validation.cpp @@ -15,10 +15,8 @@ const std::string debug_message = state.GetDebugMessage(); if (!debug_message.empty()) { - return strprintf("%s, %s (code %i)", state.GetRejectReason(), - debug_message, state.GetRejectCode()); + return strprintf("%s, %s", state.GetRejectReason(), debug_message); } - return strprintf("%s (code %i)", state.GetRejectReason(), - state.GetRejectCode()); + return strprintf("%s", state.GetRejectReason()); } diff --git a/test/functional/abc-mempool-coherence-on-activations.py b/test/functional/abc-mempool-coherence-on-activations.py --- a/test/functional/abc-mempool-coherence-on-activations.py +++ b/test/functional/abc-mempool-coherence-on-activations.py @@ -58,7 +58,7 @@ FIRST_BLOCK_TIME = ACTIVATION_TIME - 86400 # Expected RPC error when trying to send an activation specific spend txn. -RPC_EXPECTED_ERROR = "mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation) (code 16)" +RPC_EXPECTED_ERROR = "mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)" def create_fund_and_activation_specific_spending_tx(spend, pre_fork_only): diff --git a/test/functional/abc-replay-protection.py b/test/functional/abc-replay-protection.py --- a/test/functional/abc-replay-protection.py +++ b/test/functional/abc-replay-protection.py @@ -42,7 +42,7 @@ REPLAY_PROTECTION_START_TIME = 2000000000 # Error due to invalid signature -RPC_INVALID_SIGNATURE_ERROR = "mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation) (code 16)" +RPC_INVALID_SIGNATURE_ERROR = "mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)" class PreviousSpendableOutput(object): diff --git a/test/functional/abc-segwit-recovery.py b/test/functional/abc-segwit-recovery.py --- a/test/functional/abc-segwit-recovery.py +++ b/test/functional/abc-segwit-recovery.py @@ -42,9 +42,9 @@ # Error due to non clean stack CLEANSTACK_ERROR = 'non-mandatory-script-verify-flag (Extra items left on stack after execution)' -RPC_CLEANSTACK_ERROR = CLEANSTACK_ERROR + " (code 64)" +RPC_CLEANSTACK_ERROR = CLEANSTACK_ERROR EVAL_FALSE_ERROR = 'non-mandatory-script-verify-flag (Script evaluated without error but finished with a false/empty top stack elem' -RPC_EVAL_FALSE_ERROR = EVAL_FALSE_ERROR + "ent) (code 64)" +RPC_EVAL_FALSE_ERROR = EVAL_FALSE_ERROR + "ent)" class PreviousSpendableOutput(object): diff --git a/test/functional/abc_wallet_standardness.py b/test/functional/abc_wallet_standardness.py --- a/test/functional/abc_wallet_standardness.py +++ b/test/functional/abc_wallet_standardness.py @@ -52,7 +52,7 @@ self.sync_blocks() def fund_and_test_wallet(scriptPubKey, is_standard, expected_in_std_wallet, - amount=10000, spendfee=500, nonstd_error="scriptpubkey (code 64)", sign_error=None): + amount=10000, spendfee=500, nonstd_error="scriptpubkey", sign_error=None): """ Get the nonstandard node to fund a transaction, test its standardness by trying to broadcast on the standard node, @@ -184,7 +184,7 @@ # Dust also is nonstandard to fund but standard to spend. fund_and_test_wallet( - CScript([pubkey, OP_CHECKSIG]), False, True, amount=200, nonstd_error="dust (code 64)") + CScript([pubkey, OP_CHECKSIG]), False, True, amount=200, nonstd_error="dust") # and we end with an empty wallet assert_equal(std_node.getbalance(), 0) diff --git a/test/functional/feature_bip68_sequence.py b/test/functional/feature_bip68_sequence.py --- a/test/functional/feature_bip68_sequence.py +++ b/test/functional/feature_bip68_sequence.py @@ -39,7 +39,7 @@ SEQUENCE_LOCKTIME_MASK = 0x0000ffff # RPC error for non-BIP68 final transactions -NOT_FINAL_ERROR = "non-BIP68-final (code 64)" +NOT_FINAL_ERROR = "non-BIP68-final" class BIP68Test(BitcoinTestFramework): diff --git a/test/functional/feature_cltv.py b/test/functional/feature_cltv.py --- a/test/functional/feature_cltv.py +++ b/test/functional/feature_cltv.py @@ -161,7 +161,7 @@ # rejected from the mempool for exactly that reason. assert_equal( [{'txid': spendtx.hash, 'allowed': False, - 'reject-reason': '64: non-mandatory-script-verify-flag (Negative locktime)'}], + 'reject-reason': 'non-mandatory-script-verify-flag (Negative locktime)'}], self.nodes[0].testmempoolaccept( rawtxs=[spendtx.serialize().hex()], maxfeerate=0) ) diff --git a/test/functional/feature_dersig.py b/test/functional/feature_dersig.py --- a/test/functional/feature_dersig.py +++ b/test/functional/feature_dersig.py @@ -80,7 +80,7 @@ # rejected from the mempool for exactly that reason. assert_equal( [{'txid': spendtx.hash, 'allowed': False, - 'reject-reason': '16: mandatory-script-verify-flag-failed (Non-canonical DER signature)'}], + 'reject-reason': 'mandatory-script-verify-flag-failed (Non-canonical DER signature)'}], self.nodes[0].testmempoolaccept( rawtxs=[spendtx.serialize().hex()], maxfeerate=0) ) diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py --- a/test/functional/mempool_accept.py +++ b/test/functional/mempool_accept.py @@ -76,7 +76,7 @@ self.mempool_size = 0 self.check_mempool_result( result_expected=[{'txid': txid_in_block, 'allowed': False, - 'reject-reason': '18: txn-already-known'}], + 'reject-reason': 'txn-already-known'}], rawtxs=[raw_tx_in_block], ) @@ -117,7 +117,7 @@ self.mempool_size += 1 self.check_mempool_result( result_expected=[{'txid': txid_0, 'allowed': False, - 'reject-reason': '18: txn-already-in-mempool'}], + 'reject-reason': 'txn-already-in-mempool'}], rawtxs=[raw_tx_0], ) @@ -135,7 +135,7 @@ self.check_mempool_result( result_expected=[{'txid': tx.rehash(), 'allowed': False, - 'reject-reason': '18: txn-mempool-conflict'}], + 'reject-reason': 'txn-mempool-conflict'}], rawtxs=[tx.serialize().hex()], maxfeerate=0, ) @@ -205,7 +205,7 @@ # FromHex(tx, node.signrawtransactionwithwallet(ToHex(tx))['hex']) self.check_mempool_result( result_expected=[{'txid': tx.rehash( - ), 'allowed': False, 'reject-reason': '16: bad-txns-vout-empty'}], + ), 'allowed': False, 'reject-reason': 'bad-txns-vout-empty'}], rawtxs=[ToHex(tx)], ) @@ -215,7 +215,7 @@ // len(tx.vin[0].serialize())) self.check_mempool_result( result_expected=[ - {'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-txns-oversize'}], + {'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bad-txns-oversize'}], rawtxs=[ToHex(tx)], ) @@ -224,7 +224,7 @@ tx.vout[0].nValue *= -1 self.check_mempool_result( result_expected=[{'txid': tx.rehash( - ), 'allowed': False, 'reject-reason': '16: bad-txns-vout-negative'}], + ), 'allowed': False, 'reject-reason': 'bad-txns-vout-negative'}], rawtxs=[ToHex(tx)], ) @@ -235,7 +235,7 @@ 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'}], + ), 'allowed': False, 'reject-reason': 'bad-txns-vout-toolarge'}], rawtxs=[ToHex(tx)], ) @@ -245,7 +245,7 @@ tx.vout[0].nValue = 21000000 * COIN self.check_mempool_result( result_expected=[{'txid': tx.rehash( - ), 'allowed': False, 'reject-reason': '16: bad-txns-txouttotal-toolarge'}], + ), 'allowed': False, 'reject-reason': 'bad-txns-txouttotal-toolarge'}], rawtxs=[ToHex(tx)], ) @@ -254,7 +254,7 @@ tx.vin = [tx.vin[0]] * 2 self.check_mempool_result( result_expected=[{'txid': tx.rehash( - ), 'allowed': False, 'reject-reason': '16: bad-txns-inputs-duplicate'}], + ), 'allowed': False, 'reject-reason': 'bad-txns-inputs-duplicate'}], rawtxs=[ToHex(tx)], ) @@ -266,7 +266,7 @@ tx = FromHex(CTransaction(), raw_tx_coinbase_spent) self.check_mempool_result( result_expected=[ - {'txid': tx.rehash(), 'allowed': False, 'reject-reason': '16: bad-tx-coinbase'}], + {'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bad-tx-coinbase'}], rawtxs=[ToHex(tx)], ) @@ -275,14 +275,14 @@ tx.nVersion = 3 # A version currently non-standard self.check_mempool_result( result_expected=[ - {'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: version'}], + {'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'version'}], rawtxs=[ToHex(tx)], ) tx = FromHex(CTransaction(), 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'}], + {'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'scriptpubkey'}], rawtxs=[ToHex(tx)], ) tx = FromHex(CTransaction(), raw_tx_reference) @@ -290,7 +290,7 @@ tx.vin[0].scriptSig = CScript([OP_HASH160]) self.check_mempool_result( result_expected=[{'txid': tx.rehash( - ), 'allowed': False, 'reject-reason': '64: scriptsig-not-pushonly'}], + ), 'allowed': False, 'reject-reason': 'scriptsig-not-pushonly'}], rawtxs=[ToHex(tx)], ) tx = FromHex(CTransaction(), raw_tx_reference) @@ -301,7 +301,7 @@ tx.vout = [output_p2sh_burn] * num_scripts self.check_mempool_result( result_expected=[ - {'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: tx-size'}], + {'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'tx-size'}], rawtxs=[ToHex(tx)], ) tx = FromHex(CTransaction(), raw_tx_reference) @@ -310,7 +310,7 @@ tx.vout[0].nValue -= 1 self.check_mempool_result( result_expected=[ - {'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: dust'}], + {'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'dust'}], rawtxs=[ToHex(tx)], ) tx = FromHex(CTransaction(), raw_tx_reference) @@ -318,7 +318,7 @@ tx.vout = [tx.vout[0]] * 2 self.check_mempool_result( result_expected=[ - {'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: multi-op-return'}], + {'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'multi-op-return'}], rawtxs=[ToHex(tx)], ) @@ -329,7 +329,7 @@ tx.nLockTime = node.getblockcount() + 1 self.check_mempool_result( result_expected=[ - {'txid': tx.rehash(), 'allowed': False, 'reject-reason': '64: bad-txns-nonfinal'}], + {'txid': tx.rehash(), 'allowed': False, 'reject-reason': 'bad-txns-nonfinal'}], rawtxs=[ToHex(tx)], ) @@ -342,7 +342,7 @@ self.check_mempool_result( result_expected=[{'txid': tx.rehash(), 'allowed': False, - 'reject-reason': '64: non-BIP68-final'}], + 'reject-reason': 'non-BIP68-final'}], rawtxs=[tx.serialize().hex()], maxfeerate=0, ) diff --git a/test/functional/mining_prioritisetransaction.py b/test/functional/mining_prioritisetransaction.py --- a/test/functional/mining_prioritisetransaction.py +++ b/test/functional/mining_prioritisetransaction.py @@ -189,7 +189,7 @@ tx_id = self.nodes[0].decoderawtransaction(tx_hex)["txid"] # This will raise an exception due to min relay fee not being met - assert_raises_rpc_error(-26, "min relay fee not met (code 66)", + assert_raises_rpc_error(-26, "min relay fee not met", self.nodes[0].sendrawtransaction, tx_hex) assert tx_id not in self.nodes[0].getrawmempool() diff --git a/test/functional/p2p_dos_header_tree.py b/test/functional/p2p_dos_header_tree.py --- a/test/functional/p2p_dos_header_tree.py +++ b/test/functional/p2p_dos_header_tree.py @@ -64,7 +64,7 @@ } in self.nodes[0].getchaintips() self.log.info("Feed all fork headers (fails due to checkpoint)") - with self.nodes[0].assert_debug_log(['bad-fork-prior-to-checkpoint (code 67)']): + with self.nodes[0].assert_debug_log(['bad-fork-prior-to-checkpoint']): self.nodes[0].p2p.send_message(msg_headers(self.headers_fork)) self.nodes[0].p2p.wait_for_disconnect() diff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py --- a/test/functional/rpc_rawtransaction.py +++ b/test/functional/rpc_rawtransaction.py @@ -610,7 +610,7 @@ testres = self.nodes[2].testmempoolaccept( [rawTxSigned['hex']], 0.00050000)[0] assert_equal(testres['allowed'], False) - assert_equal(testres['reject-reason'], '256: absurdly-high-fee') + assert_equal(testres['reject-reason'], 'absurdly-high-fee') # and sendrawtransaction should throw assert_raises_rpc_error(-26, "absurdly-high-fee", @@ -641,7 +641,7 @@ # Thus, testmempoolaccept should reject testres = self.nodes[2].testmempoolaccept([rawTxSigned['hex']])[0] assert_equal(testres['allowed'], False) - assert_equal(testres['reject-reason'], '256: absurdly-high-fee') + assert_equal(testres['reject-reason'], 'absurdly-high-fee') # and sendrawtransaction should throw assert_raises_rpc_error(-26, "absurdly-high-fee",