CScript scriptChange;
// coin control: send change to custom address
- if (coinControl && !boost::get<CNoDestination>(&coinControl->destChange))
- scriptChange.SetDestination(coinControl->destChange);
+ if (coinControl && coinControl->destChange.IsValid())
+ scriptChange.SetAddress(coinControl->destChange);
// no coin control: send change to newly generated address
else
EraseFromWallet(*it);
}
-bool CWallet::ExtractAddress(const CScript& scriptPubKey, std::string& addressRet)
+bool CWallet::ExtractAddress(const CScript& scriptPubKey, CBitcoinAddress& addressRet)
{
vector<valtype> vSolutions;
txnouttype whichType;
if (whichType == TX_PUBKEY)
{
- addressRet = CBitcoinAddress(CPubKey(vSolutions[0]).GetID()).ToString();
+ addressRet = CBitcoinAddress(CPubKey(vSolutions[0]).GetID());
return true;
}
if (whichType == TX_PUBKEY_DROP)
if (!CheckOwnership(CPubKey(vSolutions[0]), CPubKey(vSolutions[1]), view))
return false;
- addressRet = CBitcoinAddress(view.GetMalleablePubKey()).ToString();
+ addressRet = CBitcoinAddress(view.GetMalleablePubKey());
return true;
}
else if (whichType == TX_PUBKEYHASH)
{
- addressRet = CBitcoinAddress(CKeyID(uint160(vSolutions[0]))).ToString();
+ addressRet = CBitcoinAddress(CKeyID(uint160(vSolutions[0])));
return true;
}
else if (whichType == TX_SCRIPTHASH)
{
- addressRet = CBitcoinAddress(CScriptID(uint160(vSolutions[0]))).ToString();
+ addressRet = CBitcoinAddress(CScriptID(uint160(vSolutions[0])));
return true;
}
// Multisig txns have more than one address...