mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-07 00:40:34 +02:00
Merge bitcoin/bitcoin#23644: wallet: Replace confusing getAdjustedTime() with GetTime()
fa37e798b2
wallet: Replace confusing getAdjustedTime() with GetTime() (MarcoFalke) Pull request description: Setting `nTimeReceived` to the adjusted time has several issues: * `m_best_block_time` is set to the "unadjusted" time, thus a comparison of the two times is like comparing apples to oranges. In the worst case this opens up an attack vector where remote peers can force a premature re-broadcast of wallet txs. * The RPC documentation for `"timereceived"` doesn't mention that the network adjusted time is used, possibly confusing users when the time reported by RPC is off by a few seconds compared to their local timestamp. Fix all issues by replacing the call with `GetTime()`. Also a style fix: Use non-narrowing integer conversion in the RPC method. ACKs for top commit: theStack: Code-review ACKfa37e798b2
shaavan: crACKfa37e798b2
Tree-SHA512: 8d020ba400521246b7aed4b6c41319fc70552e8c69e929a5994500375466a9edac02a0ae64b803dbc6695df22276489561a23bd6e030c44c97d288f7b9b2b3fa
This commit is contained in:
@ -915,7 +915,7 @@ CWalletTx* CWallet::AddToWallet(CTransactionRef tx, const TxState& state, const
|
||||
bool fInsertedNew = ret.second;
|
||||
bool fUpdated = update_wtx && update_wtx(wtx, fInsertedNew);
|
||||
if (fInsertedNew) {
|
||||
wtx.nTimeReceived = chain().getAdjustedTime();
|
||||
wtx.nTimeReceived = GetTime();
|
||||
wtx.nOrderPos = IncOrderPosNext(&batch);
|
||||
wtx.m_it_wtxOrdered = wtxOrdered.insert(std::make_pair(wtx.nOrderPos, &wtx));
|
||||
wtx.nTimeSmart = ComputeTimeSmart(wtx, rescanning_old_block);
|
||||
@ -1303,7 +1303,6 @@ void CWallet::updatedBlockTip()
|
||||
m_best_block_time = GetTime();
|
||||
}
|
||||
|
||||
|
||||
void CWallet::BlockUntilSyncedToCurrentChain() const {
|
||||
AssertLockNotHeld(cs_wallet);
|
||||
// Skip the queue-draining stuff if we know we're caught up with
|
||||
|
Reference in New Issue
Block a user