mapRelay
(used to relay announced transactions that are no longer in the mempool) has issues:
- It doesn’t have an absolute memory limit, only an implicit one based on the rate of transaction announcements
- It doesn’t have a use-case EDIT: see below
Fix all issues by removing mapRelay
.
For more context, on why a transaction may have been removed from the mempool, see https://github.com/bitcoin/bitcoin/blob/c2f2abd0a4f4bd18bfca41b632d21d803479f3f4/src/txmempool.h#L228-L238
For my rationale on why it is fine to not relay them:
Reason | Rationale | |
---|---|---|
EXPIRY |
Expired from mempool | Mempool expiry is by default 2 weeks and can not be less than 1 hour, so a transaction can not be in mapRelay while expiring, unless a re-broadcast happened. This should be fine, because the transaction will be re-added to the mempool and potentially announced/relayed on the next re-broadcast. |
SIZELIMIT |
Removed in size limiting | A low fee transaction, which will be relayed by a different peer after GETDATA_TX_INTERVAL or after we sent a notfound message. Assuming it ever made it to another peer, otherwise it will happen on re-broadcast (same as with EXPIRY above). |
REORG |
Removed for reorganization | Block races are rare, so reorgs should be rarer. Also, the transaction is likely to be re-accepted via the disconnectpool later on. If not, it seems fine to let the originating wallet deal with rebroadcast in this case. |
BLOCK |
Removed for block | EDIT: Needed for compact block relay, see #27625 (comment) |
CONFLICT |
Removed for conflict with in-block transaction | The peer won’t be able to add the tx to the mempool anyway, unless it is on a different block, in which case it seems fine to let the originating wallet take care of the rebroadcast (if needed). |
REPLACED |
Removed for replacement | EDIT: Also needed for compact block relay, see #27625 (comment) ? |