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
sendtoaddressto send some bitcoin to own address in Node 2
- Check transaction is in
getrawmempooland 1 unbroadcast in
- Node 1 doesn't have these transactions in
- Restart nodes
- Run this multiple times because its not doing anything:
bitcoin-cli -regtest mockscheduler 900
- Nothing changes in
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.
I checked the packets in Wireshark to see what's going on because
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
INV: 9f5e3c78e1e6a4f7f12b1e876ba6dadfcf3df6812a3ac214dda2455284e0e079 WTXID: 79e0e0845245a2dd14c23a2a81f63dcfdfdaa66b871e2bf1f7a4e6e1783c5e9f
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.