Do not resend wallet txs during IBD, rescan or loading blocks
This commit is contained in:
@@ -67,6 +67,7 @@ bool fPayAtLeastCustomFee = true;
|
|||||||
|
|
||||||
CBlockIndex *hush_chainactive(int32_t height);
|
CBlockIndex *hush_chainactive(int32_t height);
|
||||||
extern std::string DONATION_PUBKEY;
|
extern std::string DONATION_PUBKEY;
|
||||||
|
extern int32_t HUSH_LOADINGBLOCKS;
|
||||||
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
|
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
|
||||||
int tx_height( const uint256 &hash );
|
int tx_height( const uint256 &hash );
|
||||||
bool fTxDeleteEnabled = false;
|
bool fTxDeleteEnabled = false;
|
||||||
@@ -3184,7 +3185,6 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime)
|
|||||||
|
|
||||||
void CWallet::ResendWalletTransactions(int64_t nBestBlockTime)
|
void CWallet::ResendWalletTransactions(int64_t nBestBlockTime)
|
||||||
{
|
{
|
||||||
LogPrintf("%s: nBestBlockTime=%ld nNextResend=%ld nLastResend=%ld time=%ld\n", __func__, nBestBlockTime, nNextResend, nLastResend, GetTime());
|
|
||||||
// Do this infrequently and randomly to avoid giving away
|
// Do this infrequently and randomly to avoid giving away
|
||||||
// that these are our transactions.
|
// that these are our transactions.
|
||||||
if (GetTime() < nNextResend || !fBroadcastTransactions)
|
if (GetTime() < nNextResend || !fBroadcastTransactions)
|
||||||
@@ -3195,11 +3195,26 @@ void CWallet::ResendWalletTransactions(int64_t nBestBlockTime)
|
|||||||
if (fFirst)
|
if (fFirst)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// do not resend during IBD/rescan because some txs will be unconfirmed
|
||||||
|
// until completion
|
||||||
|
if(IsInitialBlockDownload()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pwalletMain->fRescanning) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not resend during a reindex or initial loading of blocks
|
||||||
|
if (HUSH_LOADINGBLOCKS) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Only do it if there's been a new block since last time
|
// Only do it if there's been a new block since last time
|
||||||
if (nBestBlockTime < nLastResend)
|
if (nBestBlockTime < nLastResend)
|
||||||
return;
|
return;
|
||||||
nLastResend = GetTime();
|
nLastResend = GetTime();
|
||||||
|
|
||||||
|
LogPrintf("%s: nBestBlockTime=%ld nNextResend=%ld nLastResend=%ld time=%ld\n", __func__, nBestBlockTime, nNextResend, nLastResend, GetTime());
|
||||||
// Rebroadcast unconfirmed txes older than 5 minutes before the last
|
// Rebroadcast unconfirmed txes older than 5 minutes before the last
|
||||||
// block was found:
|
// block was found:
|
||||||
std::vector<uint256> relayed = ResendWalletTransactionsBefore(nBestBlockTime-5*60);
|
std::vector<uint256> relayed = ResendWalletTransactionsBefore(nBestBlockTime-5*60);
|
||||||
|
|||||||
Reference in New Issue
Block a user