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