Is there an existing issue for this?
- I have searched the existing issues
Current behaviour
At first, thanks for your work, Bitcoin Core team.
AFAIK, if I send some amount to myself (retrieved with getnewaddress), it should include both send and receive elements with the same negative and positive amount respectively. This behavior is described e.g. in github issue #4807 and I can confirm that it’s a fact in some cases.
Hovewer, the .details array does not include neither send nor receive elements sometimes. It’s omitted from the output as if nothing had been sent or received.
Example:
0$ bitcoin-cli gettransaction XXX...
1{
2 "amount": -0.1,
3 "fee": -0.00002,
4 "confirmations": 7967,
5 "txid": "XXX...",
6 ...,
7 "details": [
8 {
9 "address": "SOME_RECIPIENT",
10 "category": "send",
11 "amount": -0.1,
12 "vout": 0,
13 "fee": -0.00002,
14 "abandoned": false
15 }
16 ],
17 "hex": "..."
18}
The transaction in mempool.space or other blockchain explorers shows other outputs as well.
0[
1 {
2 "value": 0.1,
3 "n": 0,
4 "address": "SOME_RECIPIENT",
5 ...
6 },
7 {
8 "value": 0.05,
9 "n": 0,
10 "address": "MY_ANOTHER_ADDRESS_1",
11 ...
12 },
13 {
14 "value": 0.04,
15 "n": 0,
16 "address": "MY_ANOTHER_ADDRESS_2",
17 ...
18 }
19]
Raw transaction in .hex element includes these of course but they are missing in the .details element.
Please note that both MY_ANOTHER_ADDRESS_n is tracked as .mine == true when I call getaddressinfo MY_ANOTHER_ADDRESS_n.
Expected behaviour
Both send and receive balance changes with the same amount appears in the details section of gettransaction output.
Steps to reproduce
These transactions are constructed with sendmany RPC call, but I am not able to reproduce them. (I tried it on testnet).
Relevant log output
I am not sure if it is relevant, but these are log lines about that transaction:
02023-09-29T19:37:16Z [default] Fee Calculation: Fee:10233 Bytes:393 Tgt:0 (requested 0) Reason:"PayTxFee set" Decay 0.00000: Estimation: (-1 - -1) 0.00% 0.0/(0.0 0 mem 0.0 out) Fail: (-1 - -1) 0.00% 0.0/(0.0 0 mem 0.0 out)
12023-09-29T19:37:41Z [default] Fee Calculation: Fee:10233 Bytes:393 Tgt:0 (requested 0) Reason:"PayTxFee set" Decay 0.00000: Estimation: (-1 - -1) 0.00% 0.0/(0.0 0 mem 0.0 out) Fail: (-1 - -1) 0.00% 0.0/(0.0 0 mem 0.0 out)
22023-09-29T19:37:41Z [default] Fee non-grouped = 10233, grouped = 10233, using grouped
32023-09-29T19:37:41Z [default] CommitTransaction:
4CTransaction(hash=XXX, ver=2, vin.size=5, vout.size=1, nLockTime=809912)
5 CTxIn(COutPoint(..., 30), scriptSig=, nSequence=4294967293)
6 CTxIn(COutPoint(..., 7), scriptSig=, nSequence=4294967293)
7 CTxIn(COutPoint(..., 11), scriptSig=, nSequence=4294967293)
8 CTxIn(COutPoint(..., 0), scriptSig=, nSequence=4294967293)
9 CTxIn(COutPoint(..., 19), scriptSig=, nSequence=4294967293)
10 CScriptWitness(...., ...)
11 CScriptWitness(...., ...)
12 CScriptWitness(...., ...)
13 CScriptWitness(...., ...)
14 CScriptWitness(...., ...)
15 CTxOut(nValue=0.14500000, scriptPubKey=...)
162023-09-29T19:37:41Z [default] AddToWallet XXX... newupdate
172023-09-29T19:37:41Z [default] Submitting wtx XXX... to mempool for relay
182023-09-29T19:37:41Z [default] MarkUnusedAddresses: Detected a used keypool item at index 121340, mark all keypool items up to this item as used
192023-09-29T19:37:41Z [default] AddToWallet XXX...
How did you obtain Bitcoin Core
Pre-built binaries
What version of Bitcoin Core are you using?
v25.0.0
Operating system and version
Debian 11 bullseye (oldstable)
Machine specifications
No response