|
|
@ -493,7 +493,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn) |
|
|
|
if (txout.scriptPubKey == scriptDefaultKey) |
|
|
|
if (txout.scriptPubKey == scriptDefaultKey) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CPubKey newDefaultKey; |
|
|
|
CPubKey newDefaultKey; |
|
|
|
if (GetKeyFromPool(newDefaultKey, false)) |
|
|
|
if (GetKeyFromPool(newDefaultKey)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SetDefaultKey(newDefaultKey); |
|
|
|
SetDefaultKey(newDefaultKey); |
|
|
|
SetAddressBook(vchDefaultKey.GetID(), "", "receive"); |
|
|
|
SetAddressBook(vchDefaultKey.GetID(), "", "receive"); |
|
|
@ -1647,7 +1647,7 @@ void CWallet::ReturnKey(int64 nIndex) |
|
|
|
printf("keypool return %"PRI64d"\n", nIndex); |
|
|
|
printf("keypool return %"PRI64d"\n", nIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool CWallet::GetKeyFromPool(CPubKey& result, bool fAllowReuse) |
|
|
|
bool CWallet::GetKeyFromPool(CPubKey& result) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int64 nIndex = 0; |
|
|
|
int64 nIndex = 0; |
|
|
|
CKeyPool keypool; |
|
|
|
CKeyPool keypool; |
|
|
@ -1656,11 +1656,6 @@ bool CWallet::GetKeyFromPool(CPubKey& result, bool fAllowReuse) |
|
|
|
ReserveKeyFromKeyPool(nIndex, keypool); |
|
|
|
ReserveKeyFromKeyPool(nIndex, keypool); |
|
|
|
if (nIndex == -1) |
|
|
|
if (nIndex == -1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fAllowReuse && vchDefaultKey.IsValid()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
result = vchDefaultKey; |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (IsLocked()) return false; |
|
|
|
if (IsLocked()) return false; |
|
|
|
result = GenerateNewKey(); |
|
|
|
result = GenerateNewKey(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|