@@ -141,12 +141,12 @@ int64_t CWallet::GetKeyCreationTime(CPubKey pubkey)
141141 return mapKeyMetadata[pubkey.GetID ()].nCreateTime ;
142142}
143143
144- int64_t CWallet::GetKeyCreationTime (const CBitcoinAddress & address)
144+ int64_t CWallet::GetKeyCreationTime (const CTxDestination & address)
145145{
146- CKeyID keyID;
147- if (address. GetKeyID ( keyID) ) {
146+ const CKeyID* keyID = boost::get<CKeyID>(&address) ;
147+ if (keyID) {
148148 CPubKey keyRet;
149- if (GetPubKey (keyID, keyRet)) {
149+ if (GetPubKey (* keyID, keyRet)) {
150150 return GetKeyCreationTime (keyRet);
151151 }
152152 }
@@ -681,15 +681,14 @@ bool CWallet::GetVinAndKeysFromOutput(COutput out, CTxIn& txinRet, CPubKey& pubK
681681
682682 CTxDestination address1;
683683 ExtractDestination (pubScript, address1, fColdStake );
684- CBitcoinAddress address2 (address1);
685684
686- CKeyID keyID;
687- if (!address2. GetKeyID ( keyID) ) {
685+ CKeyID* keyID = boost::get<CKeyID>(&address1) ;
686+ if (!keyID) {
688687 LogPrintf (" CWallet::GetVinAndKeysFromOutput -- Address does not refer to a key\n " );
689688 return false ;
690689 }
691690
692- if (!GetKey (keyID, keyRet)) {
691+ if (!GetKey (* keyID, keyRet)) {
693692 LogPrintf (" CWallet::GetVinAndKeysFromOutput -- Private key for address is not known\n " );
694693 return false ;
695694 }
@@ -1098,10 +1097,10 @@ isminetype CWallet::IsMine(const CTxIn& txin) const
10981097 return ISMINE_NO;
10991098}
11001099
1101- bool CWallet::IsUsed (const CBitcoinAddress address) const
1100+ bool CWallet::IsUsed (const CTxDestination address) const
11021101{
11031102 LOCK (cs_wallet);
1104- CScript scriptPubKey = GetScriptForDestination (address. Get () );
1103+ CScript scriptPubKey = GetScriptForDestination (address);
11051104 if (!::IsMine (*this , scriptPubKey)) {
11061105 return false ;
11071106 }
@@ -2091,7 +2090,7 @@ bool CWallet::AvailableCoins(std::vector<COutput>* pCoins, // --> populates
20912090 }
20922091}
20932092
2094- std::map<CBitcoinAddress , std::vector<COutput> > CWallet::AvailableCoinsByAddress (bool fConfirmed , CAmount maxCoinValue)
2093+ std::map<CTxDestination , std::vector<COutput> > CWallet::AvailableCoinsByAddress (bool fConfirmed , CAmount maxCoinValue)
20952094{
20962095 std::vector<COutput> vCoins;
20972096 // include cold
@@ -2102,8 +2101,8 @@ std::map<CBitcoinAddress, std::vector<COutput> > CWallet::AvailableCoinsByAddres
21022101 ALL_COINS, // coin type
21032102 fConfirmed ); // only confirmed
21042103
2105- std::map<CBitcoinAddress , std::vector<COutput> > mapCoins;
2106- for (COutput out : vCoins) {
2104+ std::map<CTxDestination , std::vector<COutput> > mapCoins;
2105+ for (COutput& out : vCoins) {
21072106 if (maxCoinValue > 0 && out.tx ->vout [out.i ].nValue > maxCoinValue)
21082107 continue ;
21092108
@@ -2117,7 +2116,7 @@ std::map<CBitcoinAddress, std::vector<COutput> > CWallet::AvailableCoinsByAddres
21172116 continue ;
21182117 }
21192118
2120- mapCoins[CBitcoinAddress ( address, fColdStakeAddr ? CChainParams::STAKING_ADDRESS : CChainParams::PUBKEY_ADDRESS) ].push_back (out);
2119+ mapCoins[address].push_back (out);
21212120 }
21222121
21232122 return mapCoins;
@@ -3026,7 +3025,7 @@ DBErrors CWallet::ZapWalletTx(std::vector<CWalletTx>& vWtx)
30263025 return DB_LOAD_OK;
30273026}
30283027
3029- CBitcoinAddress CWallet::ParseIntoAddress (const CTxDestination& dest, const std::string& purpose) {
3028+ std::string CWallet::ParseIntoAddress (const CTxDestination& dest, const std::string& purpose) {
30303029 const CChainParams::Base58Type addrType =
30313030 AddressBook::IsColdStakingPurpose (purpose) ?
30323031 CChainParams::STAKING_ADDRESS : CChainParams::PUBKEY_ADDRESS;
@@ -3046,7 +3045,7 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const std::string& s
30463045 mapAddressBook.at (address).purpose , (fUpdated ? CT_UPDATED : CT_NEW));
30473046 if (!fFileBacked )
30483047 return false ;
3049- std::string addressStr = ParseIntoAddress (address, mapAddressBook.at (address).purpose ). ToString () ;
3048+ std::string addressStr = ParseIntoAddress (address, mapAddressBook.at (address).purpose );
30503049 if (!strPurpose.empty () && !CWalletDB (strWalletFile).WritePurpose (addressStr, strPurpose))
30513050 return false ;
30523051 return CWalletDB (strWalletFile).WriteName (addressStr, strName);
@@ -3488,7 +3487,7 @@ bool CWallet::AddDestData(const CTxDestination& dest, const std::string& key, co
34883487 mapAddressBook[dest].destdata .insert (std::make_pair (key, value));
34893488 if (!fFileBacked )
34903489 return true ;
3491- return CWalletDB (strWalletFile).WriteDestData (CBitcoinAddress (dest). ToString ( ), key, value);
3490+ return CWalletDB (strWalletFile).WriteDestData (EncodeDestination (dest), key, value);
34923491}
34933492
34943493bool CWallet::EraseDestData (const CTxDestination& dest, const std::string& key)
@@ -3497,7 +3496,7 @@ bool CWallet::EraseDestData(const CTxDestination& dest, const std::string& key)
34973496 return false ;
34983497 if (!fFileBacked )
34993498 return true ;
3500- return CWalletDB (strWalletFile).EraseDestData (CBitcoinAddress (dest). ToString ( ), key);
3499+ return CWalletDB (strWalletFile).EraseDestData (EncodeDestination (dest), key);
35013500}
35023501
35033502bool CWallet::LoadDestData (const CTxDestination& dest, const std::string& key, const std::string& value)
@@ -3514,10 +3513,10 @@ void CWallet::AutoCombineDust()
35143513 return ;
35153514 }
35163515
3517- std::map<CBitcoinAddress , std::vector<COutput> > mapCoinsByAddress = AvailableCoinsByAddress (true , nAutoCombineThreshold * COIN);
3516+ std::map<CTxDestination , std::vector<COutput> > mapCoinsByAddress = AvailableCoinsByAddress (true , nAutoCombineThreshold * COIN);
35183517
35193518 // coins are sectioned by address. This combination code only wants to combine inputs that belong to the same address
3520- for (std::map<CBitcoinAddress , std::vector<COutput> >::iterator it = mapCoinsByAddress.begin (); it != mapCoinsByAddress.end (); it++) {
3519+ for (std::map<CTxDestination , std::vector<COutput> >::iterator it = mapCoinsByAddress.begin (); it != mapCoinsByAddress.end (); it++) {
35213520 std::vector<COutput> vCoins, vRewardCoins;
35223521 bool maxSize = false ;
35233522 vCoins = it->second ;
@@ -3566,7 +3565,7 @@ void CWallet::AutoCombineDust()
35663565 continue ;
35673566
35683567 std::vector<CRecipient> vecSend;
3569- CScript scriptPubKey = GetScriptForDestination (it->first . Get () );
3568+ CScript scriptPubKey = GetScriptForDestination (it->first );
35703569 vecSend.push_back (CRecipient{scriptPubKey, nTotalRewardsValue, false });
35713570
35723571 // Send change to same address
0 commit comments