Related question: Test that mempool reattempts delivery of locally submitted transaction
I tried running hidden RPC mockscheduler
, I think it worked that day after relaunching nodes few times and trying different things. Today again I am not able to do the relay similar to unbroadcast test.
- Start Node 1
- Start Node 2 with Node 1 in
addnode
- Use
sendtoaddress
to send some bitcoin to own address in Node 2 - Check transaction is in
getrawmempool
and 1 unbroadcast ingetmempoolinfo
- Node 1 doesn't have these transactions in
getrawmempool
- Restart nodes
- Run this multiple times because its not doing anything:
bitcoin-cli -regtest mockscheduler 900
- Nothing changes in
getrawmempool
orgetmempoolinfo
After reading lot of things I think the reason is Node 1 not sending getdata
request based on:
With these changes, the mempool tracks locally submitted transactions & periodically reattempts initial broadcast. Transactions submitted via the wallet or RPC are added to an "unbroadcast" set & are removed when a peer sends a getdata request, or the transaction is removed from the mempool. Every 10-15 minutes, the node reattempts an initial broadcast.
https://github.com/bitcoin/bitcoin/pull/18038/
I checked the packets in Wireshark to see what's going on because debug=mempool
and debug=net
spams with so many things that are confusing. I found that Node 2 had sent getdata
packet with 13 hashes:
getrawmempool
returns txid and we see wtxid
in Wireshark. I reversed one from Wireshark to get wtxid
INV: 9f5e3c78e1e6a4f7f12b1e876ba6dadfcf3df6812a3ac214dda2455284e0e079
WTXID: 79e0e0845245a2dd14c23a2a81f63dcfdfdaa66b871e2bf1f7a4e6e1783c5e9f
However getrawtransaction
doesn't accept wtxid so I am not sure how to check if this transaction belongs to Node 1 or Node 2. I am guessing its Node 1's transaction.
I have no clue what's going wrong and why simple relay for a transaction is not working between these 2 nodes.
mockscheduler
on? It has to be run on the node with the txs in the mempool. The wtxid is listed underhash
ingetrawtransaction
.getrawmempool true
andgetmempoolentry
also lists it aswtxid
.mockscheduler
on Node 2. Now restarted both. Did it on both nodes. Still Node 2 has 1 unbroadcastcount. Thanks for sharing thisgetrawmempool true
which confirms the transaction I'd mentioned above was from Node 1. If it was sent to Node 2 it should have been in it's mempool though.getpeerinfo
on Node 1: pastebin.com/raw/VPNYzBP2 and Node 2: pastebin.com/raw/VxBDaBZC