mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-01 19:35:52 +02:00
Merge #15452: Replace CScriptID and CKeyID in CTxDestination with dedicated types
78e407ad0cGetKeyBirthTimes should return key ids, not destinations (Gregory Sanders)70946e7feeReplace CScriptID and CKeyID in CTxDestination with dedicated types (Gregory Sanders) Pull request description: The current usage seems to be an overloading of meanings. `CScriptID` is used in the wallet as a lookup key, as well as a destination, and `CKeyID` likewise. Instead, have all destinations be dedicated types. New types: `CScriptID`->`ScriptHash` `CKeyID`->`PKHash` ACKs for commit 78e407: ryanofsky: utACK78e407ad0c. Only changes are removing extra CScriptID()s and fixing the test case. Sjors: utACK78e407ameshcollider: utACK78e407ad0cTree-SHA512: 437f59fc3afb83a40540da3351507aef5aed44e3a7f15b01ddad6226854edeee762ff0b0ef336fe3654c4cd99a205cef175211de8b639abe1130c8a6313337b9
This commit is contained in:
@@ -306,7 +306,7 @@ bool CWallet::AddKeyPubKeyWithDB(WalletBatch& batch, const CKey& secret, const C
|
||||
|
||||
// check if we need to remove from watch-only
|
||||
CScript script;
|
||||
script = GetScriptForDestination(pubkey.GetID());
|
||||
script = GetScriptForDestination(PKHash(pubkey));
|
||||
if (HaveWatchOnly(script)) {
|
||||
RemoveWatchOnly(script);
|
||||
}
|
||||
@@ -449,7 +449,7 @@ bool CWallet::LoadCScript(const CScript& redeemScript)
|
||||
* these. Do not add them to the wallet and warn. */
|
||||
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE)
|
||||
{
|
||||
std::string strAddr = EncodeDestination(CScriptID(redeemScript));
|
||||
std::string strAddr = EncodeDestination(ScriptHash(redeemScript));
|
||||
WalletLogPrintf("%s: Warning: This wallet contains a redeemScript of size %i which exceeds maximum size %i thus can never be redeemed. Do not use address %s.\n", __func__, redeemScript.size(), MAX_SCRIPT_ELEMENT_SIZE, strAddr);
|
||||
return true;
|
||||
}
|
||||
@@ -3711,7 +3711,7 @@ void CWallet::ListLockedCoins(std::vector<COutPoint>& vOutpts) const
|
||||
|
||||
/** @} */ // end of Actions
|
||||
|
||||
void CWallet::GetKeyBirthTimes(interfaces::Chain::Lock& locked_chain, std::map<CTxDestination, int64_t>& mapKeyBirth) const {
|
||||
void CWallet::GetKeyBirthTimes(interfaces::Chain::Lock& locked_chain, std::map<CKeyID, int64_t>& mapKeyBirth) const {
|
||||
AssertLockHeld(cs_wallet);
|
||||
mapKeyBirth.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user