|
|
@ -461,24 +461,24 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
if (!fHaveGUI) {
|
|
|
|
if (!fHaveGUI) {
|
|
|
|
// If default receiving address gets used, replace it with a new one
|
|
|
|
// If default receiving address gets used, replace it with a new one
|
|
|
|
if (vchDefaultKey.IsValid()) {
|
|
|
|
if (vchDefaultKey.IsValid()) {
|
|
|
|
CScript scriptDefaultKey;
|
|
|
|
CScript scriptDefaultKey;
|
|
|
|
scriptDefaultKey.SetDestination(vchDefaultKey.GetID());
|
|
|
|
scriptDefaultKey.SetDestination(vchDefaultKey.GetID());
|
|
|
|
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
|
|
|
|
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (txout.scriptPubKey == scriptDefaultKey)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CPubKey newDefaultKey;
|
|
|
|
if (txout.scriptPubKey == scriptDefaultKey)
|
|
|
|
if (GetKeyFromPool(newDefaultKey, false))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SetDefaultKey(newDefaultKey);
|
|
|
|
CPubKey newDefaultKey;
|
|
|
|
SetAddressBookName(vchDefaultKey.GetID(), "");
|
|
|
|
if (GetKeyFromPool(newDefaultKey, false))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetDefaultKey(newDefaultKey);
|
|
|
|
|
|
|
|
SetAddressBookName(vchDefaultKey.GetID(), "");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// since AddToWallet is called directly for self-originating transactions, check for consumption of own coins
|
|
|
|
// since AddToWallet is called directly for self-originating transactions, check for consumption of own coins
|
|
|
|
WalletUpdateSpent(wtx);
|
|
|
|
WalletUpdateSpent(wtx);
|
|
|
|
|
|
|
|
|
|
|
|