add CReserveScript to allow modular script keeping/returning

- use one CReserveScript per mining thread
This commit is contained in:
Jonas Schnelli
2015-07-01 08:32:30 +02:00
parent 087e65def9
commit 5496253966
6 changed files with 42 additions and 23 deletions

View File

@@ -2583,14 +2583,15 @@ void CWallet::UpdatedTransaction(const uint256 &hashTx)
}
}
void CWallet::GetScriptForMining(CScript &script)
void CWallet::GetScriptForMining(boost::shared_ptr<CReserveScript> &script)
{
CReserveKey reservekey(this);
boost::shared_ptr<CReserveKey> rKey(new CReserveKey(this));
CPubKey pubkey;
if (!reservekey.GetReservedKey(pubkey))
if (!rKey->GetReservedKey(pubkey))
return;
script = CScript() << ToByteVector(pubkey) << OP_CHECKSIG;
reservekey.KeepKey();
script = rKey;
script->reserveScript = CScript() << ToByteVector(pubkey) << OP_CHECKSIG;
}
void CWallet::LockCoin(COutPoint& output)