But, while the mining bonus shows up in the output of 'listaccounts' and 'getbalance', there's no hint of it in 'listreceivedbyaddress'. And while I can view the block at blockexplorer (and the displayed fees exactly match my local getbalance), the pubkey displayed there isn't listed in the output of getaddressesbyaccount.

Is my wallet.dat corrupt?

What might have happened?

What should I/shouldn't I do to be sure I have the privkey for the address which received the generation fees?

I've already used the 'backupwallet' function to make another copy of wallet.dat. Bitcoin is still running.

Happy to throw 1BTC to the person/persons who can help me recover from this situation!

Using bitcointools, I can see the keydata and transaction in the wallet backup. So I think I'm safe with access to the necessary key.

But it appears some bug (or confusing behavior) in bitcoind 0.3.21 is preventing the still-running client from showing everything in its wallet. A definitive explanation/fix/workaround for that problem would still be appreciated.

I had the exact same question after I generated this block http://blockexplorer.com/b/129556. I think I managed to work it out, but I don't know what I did is necessary or not. I found my default key via bitcointools. Then I created a new account containing that key:

Code:

bitcoind 1CnoM8QYx3Fuijuo4MRLgK5e5DvhsTqzcY mygen

Then, listaccounts showed the new account as well as the unnamed account containing the balance. Then I sent the balance to my address (transaction here: http://blockexplorer.com/t/661USs4LPM):

Code:

bitcoind sendtoaddress 1CnoM8QYx3Fuijuo4MRLgK5e5DvhsTqzcY 50.03

Now listreceivedbyaccount returns the correct amount in the new account: