Is there an existing issue for this?
- I have searched the existing issues
Current behaviour
I described this issue in a PR comment here, but @achow101 requested that I open a separate issue, stating that my problem is distinct from the one addressed by that PR.
The problem is that Bitcoin Core v30.2 has apparently forgotten about a transaction that I created, signed, and broadcast to consolidate some outputs. The outputs that I spent in the transaction are no longer listed by listunspent, but neither is the spending transaction listed by listtransactions. My transaction drew three inputs from a single wallet and sent one output back into that same wallet, but that unconfirmed incoming amount is not accounted for anywhere. getbalance and getbalances do not include the amount. Effectively, it looks as though I have simply lost money. I can retrieve the transaction by specifying its TxID to gettransaction, but the transaction does not appear in listtransactions.
Expected behaviour
listtransactions should show all transactions involving addresses in the wallet, even if those transactions are unconfirmed, and even if they have been evicted from the local node’s mempool.
Steps to reproduce
- Have three outputs, all sent to the same P2WPKH address. Mine were all sent in different transactions.
- Construct a transaction to consolidate the three outputs into a single output to that same address. (Yes, I know that broadcasting this transaction makes the address less quantum-resistant because its EC pubkey is now published.)
Note: The amount specified in the
0$ bitcoin-tx -create in=a1b2…c3d4:0 in=b1c2…d3e4:2 in=c1d2…e3f4:1 outaddr=12.345:bc1q…etcoutaddrargument is exactly the sum of the amounts of the three inputs. - Calculate and deduct a minimal fee from the output.
0$ bitcoin-cli -rpcwallet="${wallet}" fundrawtransaction "${hex}" '{"add_inputs":false,"subtractFeeFromOutputs":[0],"fee_rate":0.1}' - Sign the transaction using the wallet.
0$ bitcoin-cli -rpcwallet="${wallet}" signrawtransactionwithwallet "${hex}" - Broadcast the signed transaction.
Note: No
0$ bitcoin-cli sendrawtransaction "${hex}"-rpcwallet=argument was specified in this command. - Somehow cause the transaction to be evicted from the local node’s mempool.
0$ bitcoin-cli getrawtransaction "${txid}" 1error code: -5 2error message: 3No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions. - Attempt to find the transaction in the output of
listtransactions.It’s not there.0$ bitcoin-cli -rpcwallet="${wallet}" listtransactions '*' 10000 | jq --arg txid "${txid}" '.[] | select(.txid == $txid)' - Query the wallet’s balance.
The money is apparently missing!
0$ bitcoin-cli -rpcwallet="${wallet}" -named getbalance minconf=0 avoid_reuse=false - Query the wallet for the missing transaction.
The wallet indeed knows about the transaction and reports
0$ bitcoin-cli -rpcwallet="${wallet}" -named gettransaction txid="${txid}" verbose=true"confirmations": 0, yet the transaction is not accounted for anywhere.
Relevant log output
The node’s debug.log does include a line AddToWallet ${txid} new InMempool dated when the transaction was originally broadcast. It also includes another line, dated about 18½ hours later: Submitting wtx ${txid} to mempool for relay. There are no other mentions of the TxID in the log.
How did you obtain Bitcoin Core
Compiled from source
What version of Bitcoin Core are you using?
v30.2
Operating system and version
Gentoo Linux
Machine specifications
Linux 6.12.58-gentoo x86_64