bitcoin/src/node
MarcoFalke 42b25025fa
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 ACK fa37e798b2
  shaavan:
    crACK fa37e798b2

Tree-SHA512: 8d020ba400521246b7aed4b6c41319fc70552e8c69e929a5994500375466a9edac02a0ae64b803dbc6695df22276489561a23bd6e030c44c97d288f7b9b2b3fa
2021-12-07 09:02:06 +01:00
..
blockstorage.cpp Merge bitcoin/bitcoin#22937: refactor: Forbid calling unsafe fs::path(std::string) constructor and fs::path::string() method 2021-10-15 10:01:56 +02:00
blockstorage.h add missing atomic include 2021-06-22 11:06:30 +02:00
coin.cpp scripted-diff: tree-wide: Remove all review-only assertions 2021-06-10 15:05:24 -04:00
coin.h node: Use mempool from node context instead of global 2019-12-05 14:22:05 -05:00
coinstats.cpp scripted-diff: tree-wide: Remove all review-only assertions 2021-06-10 15:05:24 -04:00
coinstats.h [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
context.cpp validation: Farewell, global Chainstate! 2021-06-10 15:05:25 -04:00
context.h scripted-diff: Rename CAddrMan to AddrMan 2021-09-28 22:21:10 -04:00
interfaces.cpp wallet: Replace confusing getAdjustedTime() with GetTime() 2021-12-01 16:26:11 +01:00
miner.cpp miner: Remove uncompiled MTP code 2021-12-01 09:32:03 +01:00
miner.h miner: Remove uncompiled MTP code 2021-12-01 09:32:03 +01:00
minisketchwrapper.cpp scripted-diff: Move minisketchwrapper to src/node 2021-11-12 10:56:08 +01:00
minisketchwrapper.h Sort file list after rename 2021-11-12 10:56:27 +01:00
psbt.cpp [MOVEONLY] consensus: move amount.h into consensus 2021-09-30 07:41:57 +08:00
psbt.h refactor: post Optional<> removal cleanups 2021-03-17 14:56:20 +08:00
README.md doc: Remove irrelevant link to GitHub 2021-04-06 09:34:21 +02:00
transaction.cpp [refactor] Don't call AcceptToMemoryPool() from outside validation.cpp 2021-11-03 14:34:41 +00:00
transaction.h refactor: move GetTransaction(...) to node/transaction.cpp 2021-07-22 15:53:17 +02:00
ui_interface.cpp multiprocess: Delay wallet client construction 2021-09-16 14:17:01 -04:00
ui_interface.h multiprocess: Delay wallet client construction 2021-09-16 14:17:01 -04:00
utxo_snapshot.h validation: remove nchaintx from assumeutxo metadata 2021-04-26 13:22:37 -04:00

src/node/

The src/node/ directory contains code that needs to access node state (state in CChain, CBlockIndex, CCoinsView, CTxMemPool, and similar classes).

Code in src/node/ is meant to be segregated from code in src/wallet/ and src/qt/, to ensure wallet and GUI code changes don't interfere with node operation, to allow wallet and GUI code to run in separate processes, and to perhaps eventually allow wallet and GUI code to be maintained in separate source repositories.

As a rule of thumb, code in one of the src/node/, src/wallet/, or src/qt/ directories should avoid calling code in the other directories directly, and only invoke it indirectly through the more limited src/interfaces/ classes.

This directory is at the moment sparsely populated. Eventually more substantial files like src/validation.cpp and src/txmempool.cpp might be moved there.