aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/chain.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | scripted-diff: Rename LockAnnotation to LockAssertionpracticalswift2019-05-171-13/+13
| | | | | | | | | | | | -BEGIN VERIFY SCRIPT- git grep -l LockAnnotation | xargs sed -i 's/LockAnnotation/LockAssertion/' -END VERIFY SCRIPT-
* | Merge #16033: Hold cs_main when reading chainActive via getTipLocator(). ↵MarcoFalke2019-05-171-7/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove assumeLocked(). 9402ef0739 Remove temporary method assumeLocked(). Remove LockingStateImpl. Remove redundant cs_main locks. (practicalswift) 593a8e8a2c wallet: Use chain.lock() instead of temporary chain.assumeLocked() (practicalswift) Pull request description: Fixes #16028. Problem description: `LockAnnotation lock(::cs_main)` is a guarantee to the compiler thread analysis that `::cs_main` is locked (when it couldn't be determined otherwise). Despite being annotated with the locking guarantee ... https://github.com/bitcoin/bitcoin/blob/65526fc8666fef35ef908dbc225f706bef642c7e/src/interfaces/chain.cpp#L134-L138 ... `getTipLocator()` reads `chainActive` (via `::ChainActive()`) without holding `cs_main`. This can be verified by adding the following `AssertLockHeld(cs_main)`: ``` $ git diff diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index 59623284d..9fc693a0f 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -134,6 +134,7 @@ class LockImpl : public Chain::Lock CBlockLocator getTipLocator() override { LockAnnotation lock(::cs_main); + AssertLockHeld(::cs_main); return ::ChainActive().GetLocator(); } Optional<int> findLocatorFork(const CBlockLocator& locator) override $ make check ../build-aux/test-driver: line 107: 12881 Aborted "$@" > $log_file 2>&1 FAIL: qt/test/test_bitcoin-qt ``` ACKs for commit 9402ef: MarcoFalke: utACK 9402ef0739fdcd8e989c07c0595095e9608b243c ryanofsky: utACK 9402ef0739fdcd8e989c07c0595095e9608b243c. Changes are consolidating commits and removing redundant lock2 cs_main calls Tree-SHA512: 0a030bf0c07eb53194ecc246f973ef389dd42a0979f51932bf94bdf7e90c52473ae03be49718ee1629582b05dd8e0dc020b5a210318c93378ea4ace90c0f9f72
| * | Remove temporary method assumeLocked(). Remove LockingStateImpl. Remove ↵practicalswift2019-05-161-7/+3
| | | | | | | | | | | | redundant cs_main locks.
* | | Merge #15870: wallet: Only fail rescan when blocks have actually been prunedMarcoFalke2019-05-161-2/+6
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fa7e311e16 [doc] rpcwallet: Only fail rescan when blocks have been pruned (MarcoFalke) aaaa57c2aa scripted-diff: Bump copyright headers in wallet (MarcoFalke) faf3729242 wallet: Only fail rescan when blocks have actually been pruned (MarcoFalke) Pull request description: This brings the behaviour of the import* calls closer to importmulti. After this change, the difference between importmulti and the other import* calls is * that in importmulti you can "opt-out" of scanning early blocks by setting a later timestamp. * that in importmulti the wallet will successfully import the data, but fail to rescan. Whereas in the other calls, the wallet will abort before importing the data. ACKs for commit fa7e31: promag: utACK fa7e311e169349bfcf1dab8b980724e8ddf4e749. jnewbery: utACK fa7e311e169349bfcf1dab8b980724e8ddf4e749 Tree-SHA512: a57d52ffea94b64e0eb9b5d3a7a63031325833908297dd14eb0c5251ffea3b2113b131003f1db4e9599e014369165a57f107a7150bb65e4c791e5fe742f33cb8
| * | wallet: Only fail rescan when blocks have actually been prunedMarcoFalke2019-05-061-2/+6
| | |
* | | [refactor] interfaces: Add missing LockAnnotation for cs_mainMarcoFalke2019-05-131-1/+14
| |/ |/|
* | scripted-diff: replace chainActive -> ::ChainActive()James O'Beirne2019-05-031-13/+13
| | | | | | | | | | | | | | | | | | | | Though at the moment ChainActive() simply references `g_chainstate.m_chain`, doing this change now clears the way for multiple chainstate usage and allows us to script the diff. -BEGIN VERIFY SCRIPT- git grep -l "chainActive" | grep -E '(h|cpp)$' | xargs sed -i '/chainActive =/b; /extern CChain& chainActive/b; s/\(::\)\{0,1\}chainActive/::ChainActive()/g' -END VERIFY SCRIPT-
* | Merge #15842: refactor: replace isPotentialtip/waitForNotifications by ↵MarcoFalke2019-05-011-7/+10
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | higher method 422677963a refactor: replace isPotentialtip/waitForNotifications by higher method (Antoine Riard) edfe9438ca Add WITH_LOCK macro: run code while locking a mutex (Antoine Riard) Pull request description: In Chain interface, instead of a isPotentialTip and a WaitForNotifications method, both used only once in CWallet::BlockUntilSyncedToCurrentChain, combine them in a higher WaitForNotificationsUpToTip method. Semantic should be unchanged, wallet wait for pending notifications to be processed unless block hash points to the current chain tip or a descendant. ACKs for commit 422677: jnewbery: ACK 422677963a7b41e340b911b4cd53d29dd8d63f21 ryanofsky: utACK 422677963a7b41e340b911b4cd53d29dd8d63f21. Only change is adding the cs_wallet lock annotation. Tree-SHA512: 2834ff0218795ef607543fae822e5cce25d759c1a9cfcb1f896a4af03071faed5276fbe0966e0c6ed65dc0e88af161899c5b2ca358a2d24fe70969a550000bf2
| * refactor: replace isPotentialtip/waitForNotifications by higher methodAntoine Riard2019-04-231-7/+10
| | | | | | | | | | Add GUARDED_BY(cs_wallet) annotation to m_last_block_processed, given that its now guarded by cs_wallet instead of cs_main
* | Merge #15778: [wallet] Move maxtxfee from node to walletMarcoFalke2019-04-271-1/+0
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5c759c73b2 [wallet] Move maxTxFee to wallet (John Newbery) Pull request description: Closes #15355 Moves the `-maxtxfee` from the node to the wallet. See discussion in issue for details. This is a cleanup. There is no change in behaviour. Completes #15620 ACKs for commit 5c759c: MarcoFalke: utACK 5c759c73b2602c7fde1c50dbafe5525904c1b64c ryanofsky: utACK 5c759c73b2602c7fde1c50dbafe5525904c1b64c. Changes since last review: updated commit message and an error message and method name. meshcollider: utACK https://github.com/bitcoin/bitcoin/pull/15778/commits/5c759c73b2602c7fde1c50dbafe5525904c1b64c Tree-SHA512: 2f9b2729da3940a5cda994d3f3bc11ee1a52fcc1c5e9842ea0ea63e4eb0300e8416853046776311298bc449ba07554aa46f0f245ce28598a5b0bd7347c12e752
| * | [wallet] Move maxTxFee to walletJohn Newbery2019-04-181-1/+0
| |/ | | | | | | | | | | | | | | This commit moves the maxtxfee setting to the wallet. There is only one minor behavior change: - an error message in feebumper now refers to -maxtxfee instead of maxTxFee.
* | Merge #15670: refactor: combine ↵MarcoFalke2019-04-191-16/+2
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chain::findFirstBlockWithTime/findFirstBlockWithTimeAndHeight 765c0b364d refactor: combine Chain::findFirstBlockWithTime/findFirstBlockWithTimeAndHeight (Antoine Riard) Pull request description: As suggested in #14711, pass height to CChain::FindEarliestAtLeast to simplify Chain interface by combining findFirstBlockWithTime and findFirstBlockWithTimeAndHeight into one ACKs for commit 765c0b: jnewbery: utACK 765c0b364d41e9a251c3f88cbe203645854fd790. Nice work @ariard! ryanofsky: utACK 765c0b364d41e9a251c3f88cbe203645854fd790. Looks good, thanks for implementing the suggestion! Tree-SHA512: 63f98252a93da95f08c0b6325ea98f717aa9ae4036d17eaa6edbec68e5ddd65672d66a6af267b80c36311fffa9b415a47308e95ea7718b300b685e23d4e9e6ec
| * refactor: combine Chain::findFirstBlockWithTime/findFirstBlockWithTimeAndHeightAntoine Riard2019-03-271-16/+2
| | | | | | | | | | | | | | | | As suggested in #14711, pass height to CChain::FindEarliestAtLeast to simplify Chain interface by combining findFirstBlockWithTime and findFirstBlockWithTimeAndHeight into one Extend findearliestatleast_edge_test in consequence
* | Remove access to node globals from wallet-linked codeRussell Yanofsky2019-04-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | Remove last few instances of accesses to node global variables from wallet code. Also remove accesses to node globals from code in policy/policy.cpp that isn't actually called by wallet code, but does get linked into wallet code. This is the last change needed to allow bitcoin-wallet tool to be linked without depending on libbitcoin_server.a, to ensure wallet code doesn't access node global state and avoid bugs like https://github.com/bitcoin/bitcoin/pull/15557#discussion_r267735431
* | [build] Move policy settings to new src/policy/settings unitJohn Newbery2019-04-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This moves the following policy settings functions and globals to a new src/policy/settings unit in lib_server: - `incrementalRelayFee` - `dustRelayFee` - `nBytesPerSigOp` - `fIsBareMultisigStd` These settings are only required by the node and should not be accessed by other libraries.
* | [wallet] Schedule tx rebroadcasts in walletJohn Newbery2019-04-091-10/+1
| | | | | | | | | | | | | | | | | | Removes the now-unused Broadcast/ResendWalletTransactions interface from validationinterface. The wallet_resendwallettransactions.py needs a sleep added at the start to make sure that the rebroadcast scheduler is warmed up before the next block is mined.
* | [wallet] Keep track of the best block time in the walletJohn Newbery2019-04-091-2/+6
| | | | | | | | | | Move nTimeBestReceived (which is only used for wallet rebroadcasts) into the wallet.
* | interfaces: Add Chain::requestMempoolTransactionsJoão Barbosa2019-03-311-0/+7
|/
* Remove remaining wallet accesses to node globalsRussell Yanofsky2019-03-061-0/+9
|
* Remove use of CCoinsViewMemPool::GetCoin in wallet codeRussell Yanofsky2019-03-051-0/+2
| | | | This commit does not change behavior.
* Remove use of CRPCTable::appendCommand in wallet codeRussell Yanofsky2019-03-051-1/+46
| | | | This commit does not change behavior.
* Remove use CValidationInterface in wallet codeRussell Yanofsky2019-03-051-0/+56
| | | | This commit does not change behavior.
* Suggested interfaces::Chain cleanups from #15288Russell Yanofsky2019-03-041-4/+4
| | | | | | Mostly documentation improvements requested in the last review of #15288 before it was merged (https://github.com/bitcoin/bitcoin/pull/15288#pullrequestreview-210241864)
* Remove use of IsInitialBlockDownload in wallet codeRussell Yanofsky2019-02-221-0/+1
| | | | This commit does not change behavior.
* Remove use of uiInterface.LoadWallet in wallet codeRussell Yanofsky2019-02-221-0/+2
| | | | | | | | | This also changes the uiInterface.LoadWallet signal argument type from shared_ptr<CWallet> to unique_ptr<interfaces::Wallet> because CWallet is an internal wallet class that shouldn't be used in non-wallet code (and also can't be passed across process boundaries). This commit does not change behavior.
* Remove use of AcceptToMemoryPool in wallet codeRussell Yanofsky2019-02-221-0/+8
| | | | This commit does not change behavior.
* Remove uses of InitMessage/Warning/Error in wallet codeRussell Yanofsky2019-02-221-0/+4
| | | | This commit does not change behavior.
* Remove uses of GetAdjustedTime in wallet codeRussell Yanofsky2019-02-221-0/+2
| | | | This commit does not change behavior.
* Remove use of g_connman / PushInventory in wallet codeRussell Yanofsky2019-02-221-0/+6
| | | | This commit does not change behavior.
* Remove uses of g_connman in wallet codeRussell Yanofsky2019-02-221-0/+2
| | | | This commit does not change behavior.
* Remove uses of fPruneMode in wallet codeRussell Yanofsky2019-02-221-0/+1
| | | | This commit does not change behavior.
* Remove uses of fee globals in wallet codeRussell Yanofsky2019-02-221-0/+14
| | | | This commit does not change behavior.
* Remove use of CalculateMemPoolAncestors in wallet codeRussell Yanofsky2019-02-221-0/+14
| | | | This commit does not change behavior.
* Remove use of GetTransactionAncestry in wallet codeRussell Yanofsky2019-02-221-0/+4
| | | | This commit does not change behavior.
* Remove use of GetCountWithDescendants in wallet codeRussell Yanofsky2019-02-221-0/+6
| | | | This commit does not change behavior.
* Remove use of IsRBFOptIn in wallet codeRussell Yanofsky2019-02-221-0/+7
| | | | This commit does not change behavior.
* Remove uses of CheckFinalTx in wallet codeRussell Yanofsky2019-02-221-0/+6
| | | | This commit does not change behavior.
* Rename Chain getLocator -> getTipLocatorRussell Yanofsky2019-02-011-1/+1
| | | | Suggested https://github.com/bitcoin/bitcoin/pull/14711#discussion_r252044389
* Remove remaining chainActive references from CWalletRussell Yanofsky2019-01-151-0/+20
| | | | | | This commit does not change behavior. Co-authored-by: Ben Woosley <[email protected]>
* Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new ↵Russell Yanofsky2019-01-151-0/+41
| | | | | | | | | | Chain apis Only change in behavior is "Rescan started from block <height>" message replaced by "Rescan started from block <hash>" message in ScanForWalletTransactions. Co-authored-by: Ben Woosley <[email protected]>
* Add findFork and findBlock to the Chain interfaceRussell Yanofsky2019-01-151-0/+39
| | | | | | | | And use them to remove uses of chainActive and mapBlockIndex in wallet code This commit does not change behavior. Co-authored-by: Ben Woosley <[email protected]>
* Add time methods to the Chain interfaceRussell Yanofsky2019-01-151-0/+12
| | | | | | | | And use them to remove uses of chainActive and mapBlockIndex in wallet code This commit does not change behavior. Co-authored-by: Ben Woosley <[email protected]>
* Add height, depth, and hash methods to the Chain interfaceRussell Yanofsky2019-01-151-0/+30
| | | | | | | | And use them to remove uses of chainActive and mapBlockIndex in wallet code This commit does not change behavior. Co-authored-by: Ben Woosley <[email protected]>
* Remove uses of cs_main in wallet codeRussell Yanofsky2018-11-061-0/+24
| | | | | | | | This commit does not change behavior. It is easiest to review this change with: git log -p -n1 -U0
* Add skeleton chain and client classesRussell Yanofsky2018-11-061-0/+20
This commit does not change behavior. It just adds new skeleton classes that don't do anything and aren't instantiated yet.