Commit fbe48f9
committed
Merge bitcoin/bitcoin#27625: p2p: Stop relaying non-mempool txs
faa2976 Remove mapRelay (MarcoFalke)
fccecd7 net_processing: relay txs from m_most_recent_block (Anthony Towns)
Pull request description:
`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
* <strike>It doesn't have a use-case</strike> 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 bitcoin/bitcoin#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 bitcoin/bitcoin#27625 (comment) ?
ACKs for top commit:
sdaftuar:
ACK faa2976
ajtowns:
ACK faa2976
glozow:
code review ACK faa2976
Tree-SHA512: 64ae3e387b001bf6bd5b6c938e7317f4361f9bc0b8cc5d8f63a16cda2408d2f634a22f8157dfcd8957502ef358208292ec91e7d70c9c2d8a8c47cc0114ecfebd2 files changed
+52
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 54 | + | |
57 | 55 | | |
58 | 56 | | |
59 | 57 | | |
| |||
851 | 849 | | |
852 | 850 | | |
853 | 851 | | |
| 852 | + | |
854 | 853 | | |
855 | 854 | | |
856 | 855 | | |
| |||
910 | 909 | | |
911 | 910 | | |
912 | 911 | | |
913 | | - | |
| 912 | + | |
914 | 913 | | |
915 | 914 | | |
916 | 915 | | |
| |||
919 | 918 | | |
920 | 919 | | |
921 | 920 | | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | 921 | | |
929 | 922 | | |
930 | 923 | | |
| |||
1927 | 1920 | | |
1928 | 1921 | | |
1929 | 1922 | | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
1930 | 1929 | | |
1931 | 1930 | | |
1932 | 1931 | | |
1933 | 1932 | | |
| 1933 | + | |
1934 | 1934 | | |
1935 | 1935 | | |
1936 | 1936 | | |
| |||
2301 | 2301 | | |
2302 | 2302 | | |
2303 | 2303 | | |
2304 | | - | |
2305 | | - | |
2306 | | - | |
2307 | | - | |
2308 | | - | |
2309 | | - | |
2310 | | - | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
2311 | 2315 | | |
2312 | 2316 | | |
2313 | 2317 | | |
| |||
5778 | 5782 | | |
5779 | 5783 | | |
5780 | 5784 | | |
5781 | | - | |
5782 | 5785 | | |
5783 | 5786 | | |
5784 | 5787 | | |
| |||
5788 | 5791 | | |
5789 | 5792 | | |
5790 | 5793 | | |
5791 | | - | |
5792 | | - | |
5793 | | - | |
5794 | | - | |
5795 | | - | |
5796 | | - | |
5797 | | - | |
5798 | | - | |
5799 | | - | |
5800 | | - | |
5801 | | - | |
5802 | | - | |
5803 | | - | |
5804 | | - | |
5805 | | - | |
5806 | | - | |
5807 | | - | |
5808 | | - | |
5809 | 5794 | | |
5810 | 5795 | | |
5811 | 5796 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
48 | 76 | | |
49 | 77 | | |
| 78 | + | |
50 | 79 | | |
51 | 80 | | |
52 | 81 | | |
| |||
0 commit comments