Skip to content

Commit

Permalink
refactor: move nTimeBestReceived to CWallet
Browse files Browse the repository at this point in the history
  • Loading branch information
panleone committed Apr 7, 2024
1 parent db78a7e commit 4331c30
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

using namespace std::chrono_literals;

int64_t nTimeBestReceived = 0; // Used only to inform the wallet of when we last received a block

static const uint64_t RANDOMIZER_ID_ADDRESS_RELAY = 0x3cac0035b5866b90ULL; // SHA256("main address relay")[0:8]

Expand Down Expand Up @@ -757,8 +756,6 @@ void PeerLogicValidation::UpdatedBlockTip(const CBlockIndex* pindexNew, const CB
}
});
}

nTimeBestReceived = GetTime();
}

void PeerLogicValidation::BlockChecked(const CBlock& block, const CValidationState& state)
Expand Down
1 change: 0 additions & 1 deletion src/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ extern BlockMap mapBlockIndex;
extern PrevBlockMap mapPrevBlockIndex;
extern uint64_t nLastBlockTx;
extern uint64_t nLastBlockSize;
extern int64_t nTimeBestReceived;

// Best block section
extern Mutex g_best_block_mutex;
Expand Down
5 changes: 5 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,11 @@ void CWallet::ResendWalletTransactions(CConnman* connman)
}
}

void CWallet::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload)
{
nTimeBestReceived = GetTime();
}

/** @} */ // end of mapWallet


Expand Down
2 changes: 2 additions & 0 deletions src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface

int64_t nNextResend;
int64_t nLastResend;
int64_t nTimeBestReceived = 0; // Used only to inform the wallet of when we last received a block

/**
* Used to keep track of spent outpoints, and
Expand Down Expand Up @@ -1042,6 +1043,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
void TransactionRemovedFromMempool(const CTransactionRef &ptx, MemPoolRemovalReason reason) override;
void ReacceptWalletTransactions(bool fFirstLoad = false);
void ResendWalletTransactions(CConnman* connman) override;
void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) override;

struct Balance {
CAmount m_mine_trusted{0}; //!< Trusted, at depth=GetBalance.min_depth or more
Expand Down

0 comments on commit 4331c30

Please sign in to comment.