In v0.19.0.1, I’m running regtest, creating a wallet with avoid_reuse=true
, generating 31 blocks in that wallet, then generating 100 more blocks to a throwaway address to have the rewards mature.
Then I send 1 BTC to a throwaway address, expecting to see all 31 block rewards spent at once, but the resulting transaction only has 1 input. The other 30 rewards show as "reused":true
when I listunspent
, but when I run getbalances
I see them showing us as trusted
, not as used
like I would expect.
Here’s a log:
$ junk=mmmmmmmmmmmmmmmmmmmmmmmmmmmmq4S8nX
$ alias bcr-'bitcoin-cli -regtest'
$ alias bcrt='bcr -rpcwallet=test'
$ bcr -named createwallet wallet_name=test avoid_reuse=true
{
"name": "test",
"warning": ""
}
$ addr=$(bcrt getnewaddress)
$ bcr generatetoaddress 31 $addr | wc -l # generate 31 rewards
33
$ bcr generatetoaddress 100 $junk | wc -l # let them mature
102
$ bcrt getbalances
{
"mine": {
"trusted": 1550.00000000,
"untrusted_pending": 0.00000000,
"immature": 0.00000000,
"used": 0.00000000
}
}
$ txid=$(bcrt sendtoaddress $junk 1)
# list the #confs for each input of the spend tx - note only one utxo was spent
$ bcrt getrawtransaction $txid 1 | jq -r '.vin[] | .txid' | while read txid; do bcrt gettransaction $txid | jq -r .confirmations; done
107
# list the #confs for the unspent rewards - note the 107 conf utxo is missing
$ echo $(bcrt listunspent | jq -cM '.[] | .confirmations' | sort)
101 102 103 104 105 106 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
$ bcrt getbalances # but the 30 unspent rewards are still "trusted" not "used"
{
"mine": {
"trusted": 1548.99996640,
"untrusted_pending": 0.00000000,
"immature": 0.00000000,
"used": 0.00000000
}
}
# although they show as "reused" in listunspent:
$ bcrt listunspent 0 | jq -cM '.[] | {reused,amount,confirmations,spendable,address}' | sort | head -n 10
{"reused":false,"amount":48.9999664,"confirmations":0,"spendable":true,"address":"2NAnHxL7tve4xnom7Y3f5747qzyFDEpP1Li"}
{"reused":true,"amount":50,"confirmations":101,"spendable":true,"address":"2Mww9FTTSMjc9HGsrc6swRVVzkNaus6SEMw"}
{"reused":true,"amount":50,"confirmations":102,"spendable":true,"address":"2Mww9FTTSMjc9HGsrc6swRVVzkNaus6SEMw"}
{"reused":true,"amount":50,"confirmations":103,"spendable":true,"address":"2Mww9FTTSMjc9HGsrc6swRVVzkNaus6SEMw"}
{"reused":true,"amount":50,"confirmations":104,"spendable":true,"address":"2Mww9FTTSMjc9HGsrc6swRVVzkNaus6SEMw"}
{"reused":true,"amount":50,"confirmations":105,"spendable":true,"address":"2Mww9FTTSMjc9HGsrc6swRVVzkNaus6SEMw"}
{"reused":true,"amount":50,"confirmations":106,"spendable":true,"address":"2Mww9FTTSMjc9HGsrc6swRVVzkNaus6SEMw"}
{"reused":true,"amount":50,"confirmations":108,"spendable":true,"address":"2Mww9FTTSMjc9HGsrc6swRVVzkNaus6SEMw"}
{"reused":true,"amount":50,"confirmations":109,"spendable":true,"address":"2Mww9FTTSMjc9HGsrc6swRVVzkNaus6SEMw"}
{"reused":true,"amount":50,"confirmations":110,"spendable":true,"address":"2Mww9FTTSMjc9HGsrc6swRVVzkNaus6SEMw"}
$