I am running the ruimarinho/bitcoin-core docker image and trying to understand why the block reward is going to the wrong btc address.
I have the following scenario:
$ bitcoin-cli -regtest createwallet mywallet
{
"name": "mywallet",
"warning": ""
}
$ bitcoin-cli -regtest createwallet minerwallet
{
"name": "minerwallet",
"warning": ""
}
$ ADDR=$(bitcoin-cli -regtest -rpcwallet=mywallet getnewaddress mywallet legacy)
$ MINER_ADDR=$(bitcoin-cli -regtest -rpcwallet=minerwallet getnewaddress minerwallet legacy)
$ echo $ADDR $MINER_ADDR
muHrQQbYfhzVH4GCTZh4ZnKZvWBHVcqg66 mz3QWUnL94q2RdRxFtPq747SngoBu5uQMi
$ bitcoin-cli -regtest generatetoaddress 101 $ADDR # generate 100 blocks which will add bitcoin to 'mywallet'
$ TXID=$(bitcoin-cli -regtest -rpcwallet=mywallet sendtoaddress) "mtuFXC3oACRqVMMqN32L5VG7ZCbaE7aZxi" 10 # send 10 btc to random addr
$ bitcoin-cli -regtest -rpcwallet=minerwallet generateblock $MINER_ADDR "[\"$TXID\"]" # mine the transaction
$ bitcoin-cli -regtest -rpcwallet=mywallet getbalance
89.99977500
$ bitcoin-cli -regtest -rpcwallet=minerwallet getbalance
0.00000000
Why is the minerwallet not getting the block reward of 50 btc? I was expecting this output:
$ bitcoin-cli -regtest -rpcwallet=mywallet getbalance
39.999775
$ bitcoin-cli -regtest -rpcwallet=minerwallet getbalance
50.000000