X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwallet.cpp;h=a78a76b0c16aeea8bc670811c4a17ed8325bf2ff;hb=a51b421f76da8bfb88dedd159789eec0063d3087;hp=23dc013a6312da378d1f6c42e3c43b029508b89a;hpb=b71efb4bed31f4cfdd6dbaeb72fe10c80089665d;p=novacoin.git diff --git a/src/wallet.cpp b/src/wallet.cpp index 23dc013..a78a76b 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1681,7 +1681,7 @@ bool CWallet::GetStakeWeight(const CKeyStore& keystore, uint64& nMinWeight, uint } if (fDebug) - printf("Get stake weight: %zu meta items loaded for %zu coins\n", mapMeta.size(), setCoins.size()); + printf("Get stake weight: %d meta items loaded for %d coins\n", mapMeta.size(), setCoins.size()); fCoinsDataActual = true; } @@ -1914,7 +1914,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int } if (fDebug) - printf("Stake miner: %zu meta items loaded for %zu coins\n", mapMeta.size(), setCoins.size()); + printf("Stake miner: %d meta items loaded for %d coins\n", mapMeta.size(), setCoins.size()); fCoinsDataActual = true; } @@ -2781,3 +2781,21 @@ void CWallet::GetKeyBirthTimes(std::map &mapKeyBirth) const { for (std::map::const_iterator it = mapKeyFirstBlock.begin(); it != mapKeyFirstBlock.end(); it++) mapKeyBirth[it->first] = it->second->nTime - 7200; // block times can be 2h off } + +void CWallet::ClearOrphans() +{ + list orphans; + + LOCK(cs_wallet); + for(map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) + { + const CWalletTx *wtx = &(*it).second; + if((wtx->IsCoinBase() || wtx->IsCoinStake()) && !wtx->IsInMainChain()) + { + orphans.push_back(wtx->GetHash()); + } + } + + for(list::const_iterator it = orphans.begin(); it != orphans.end(); ++it) + EraseFromWallet(*it); +} \ No newline at end of file