Allow the default key to be unavailable

This solves the issue where no default key can be added after -salvagewallet.
This commit is contained in:
Pieter Wuille
2013-04-25 19:30:28 +02:00
committed by Pieter Wuille
parent 77a1e12eed
commit 360cfe142c
4 changed files with 32 additions and 24 deletions

View File

@@ -4158,7 +4158,10 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey)
txNew.vin.resize(1);
txNew.vin[0].prevout.SetNull();
txNew.vout.resize(1);
txNew.vout[0].scriptPubKey << reservekey.GetReservedKey() << OP_CHECKSIG;
CPubKey pubkey;
if (!reservekey.GetReservedKey(pubkey))
return NULL;
txNew.vout[0].scriptPubKey << pubkey << OP_CHECKSIG;
// Add our coinbase tx as first transaction
pblock->vtx.push_back(txNew);