X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwallet.cpp;h=07518d010fa80cd3977bdee5bd7a44138123de47;hb=4a6759691d71bf2a7d2a0a9e4710f0887e66ab02;hp=beb5d856186664ed5003485a3185c1cfcbeef6b3;hpb=ab0e30c40cc589661ceb4f0d09c9373ecaefc3a9;p=novacoin.git diff --git a/src/wallet.cpp b/src/wallet.cpp index beb5d85..07518d0 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1152,23 +1152,25 @@ void CWalletTx::RelayWalletTransaction() RelayWalletTransaction(txdb); } -void CWallet::ResendWalletTransactions() +void CWallet::ResendWalletTransactions(bool fForceResend) { - // Do this infrequently and randomly to avoid giving away - // that these are our transactions. - static int64_t nNextTime = GetRand(GetTime() + 30 * 60); - if (GetTime() < nNextTime) - return; - bool fFirst = (nNextTime == 0); - nNextTime = GetTime() + GetRand(30 * 60); - if (fFirst) - return; + if (!fForceResend) { + // Do this infrequently and randomly to avoid giving away + // that these are our transactions. + static int64_t nNextTime = GetRand(GetTime() + 30 * 60); + if (GetTime() < nNextTime) + return; + bool fFirst = (nNextTime == 0); + nNextTime = GetTime() + GetRand(30 * 60); + if (fFirst) + return; - // Only do it if there's been a new block since last time - static int64_t nLastTime = 0; - if (nTimeBestReceived < nLastTime) - return; - nLastTime = GetTime(); + // Only do it if there's been a new block since last time + static int64_t nLastTime = 0; + if (nTimeBestReceived < nLastTime) + return; + nLastTime = GetTime(); + } // Rebroadcast any of our txes that aren't in a block yet printf("ResendWalletTransactions()\n"); @@ -1182,7 +1184,7 @@ void CWallet::ResendWalletTransactions() CWalletTx& wtx = item.second; // Don't rebroadcast until it's had plenty of time that // it should have gotten in already by now. - if (nTimeBestReceived - (int64_t)wtx.nTimeReceived > 5 * 60) + if (fForceResend || nTimeBestReceived - (int64_t)wtx.nTimeReceived > 5 * 60) mapSorted.insert(make_pair(wtx.nTimeReceived, &wtx)); } BOOST_FOREACH(PAIRTYPE(const unsigned int, CWalletTx*)& item, mapSorted) @@ -2766,7 +2768,7 @@ void CWallet::GetAddresses(std::map &mapAddresses) con // iterate over all their outputs CBitcoinAddress addressRet; if (const_cast(this)->ExtractAddress(out.scriptPubKey, addressRet)) { - if (mapAddresses.find(addressRet) != mapAddresses.end() && mapAddresses[addressRet] > wtx.nTime) + if (mapAddresses.find(addressRet) != mapAddresses.end() && (mapAddresses[addressRet] == 0 || mapAddresses[addressRet] > wtx.nTime)) mapAddresses[addressRet] = wtx.nTime; } else { @@ -2776,14 +2778,12 @@ void CWallet::GetAddresses(std::map &mapAddresses) con for(std::vector::const_iterator it3 = vAffected.begin(); it3 != vAffected.end(); it3++) { CBitcoinAddress addrAffected(*it3); - - if (mapAddresses.find(addrAffected) != mapAddresses.end() && mapAddresses[addrAffected] > wtx.nTime) + if (mapAddresses.find(addrAffected) != mapAddresses.end() && (mapAddresses[addrAffected] == 0 || mapAddresses[addrAffected] > wtx.nTime)) mapAddresses[addrAffected] = wtx.nTime; } vAffected.clear(); } } - } }