Author: Dustin Dettmer 2019-03-06 04:00:35
Published on: 2019-03-06T04:00:35+00:00
The Bitcoin Core has the feature of sending "reject" messages in response to "tx", "block" or "version" messages from a network peer when the message could not be accepted, but this feature has been disabled by default since Bitcoin Core version 0.18.0. Nodes on the network cannot generally be trusted to send valid ("reject") messages, so this should only ever be used when connected to a trusted node. Testing or debugging of implementations of the Bitcoin P2P network protocol can be done by inspecting the log messages that are produced by a recent version of Bitcoin Core. Testing the validity of a block can be achieved through specific RPCs such as `submitblock` and `getblocktemplate` with `'mode'` set to `'proposal'`. Similarly, testing the validity of a transaction can be achieved by specific RPCs like `sendrawtransaction` and `testmempoolaccept`.Wallets should not use the absence of "reject" messages to indicate a transaction has propagated the network, nor should wallets use "reject" messages to set transaction fees. Instead, they should use fee estimation to determine transaction fees and set replace-by-fee if desired. Thus, they could wait until the transaction has confirmed (taking into account the fee target they set (compare the RPC `estimatesmartfee`)) or listen for the transaction announcement by other network peers to check for propagation.The reject message is helpful for figuring out why a tx was rejected, but it's not useful for determining success, especially when doing segwit/newer types of tx's as there's always one or more pesky nodes who still don't support it and send a reject message for perfectly good tx's. However, after a delay where you haven't seen your tx propagated on the network, it's useful to know *why* it failed. What would be nice is actually expanding this error message. Currently with RBF tx's “fee too small” is sent for both original transactions as well as replacement transactions. So a bug accidentally sending spent txos (currently in mempool) says “fee too small” instead of something more appropriate like “fee too small to supersede existing unconfirmed transaction”. The proposer suggests removing "reject" messages from Bitcoin Core 0.19.0 unless there are valid concerns about its removal to make the codebase slimmer, easier to understand and maintain.
Updated on: 2023-06-13T17:17:26.538681+00:00