Skip to content

Conversation

ryanofsky
Copy link
Contributor

@ryanofsky ryanofsky commented Nov 12, 2018

This change removes uses of chainActive and mapBlockIndex globals in wallet code. It is a refactoring change which does not affect external behavior.

This is the next step in the larger #10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in #10102.

@maflcko
Copy link
Member

maflcko commented Nov 12, 2018

Concept ACK. Though, I'd prefer if we first cleaned up the interface for ScanForWalletTransactions. I believe that right now it is relying on too much undefined behaviour that this refactoring could be meaningfully reviewed.

@maflcko maflcko added this to the 0.18.0 milestone Nov 12, 2018
@ryanofsky
Copy link
Contributor Author

too much undefined behaviour that this refactoring could be meaningfully reviewed.

Are you talking about a small part of this PR or the whole thing? Most of the changes here don't have anything to do with ScanForWalletTransactions. I could even drop the rescan changes and save them for a different PR if you are only worried about them.

@practicalswift
Copy link
Contributor

Concept ACK

Nice readability and robustness improvement

@Empact
Copy link
Contributor

Empact commented Nov 13, 2018

Concept ACK

Would be easier/safer to review if split up. Like Marco, I’d like to see ScanFor improved first.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 13, 2018

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #15129 (rpc: Added ability to remove watch only addresses by benthecarman)
  • #14942 (wallet: Return a ScanResult from CWallet::RescanFromTime by Empact)
  • #14533 (wallet: ensure wallet files are not reused across chains by mrwhythat)
  • #10973 (Refactor: separate wallet from node by ryanofsky)
  • #10102 ([experimental] Multiprocess bitcoin by ryanofsky)
  • #9381 (Remove CWalletTx merging logic from AddToWallet by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Contributor

@meshcollider meshcollider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK d568bdb

while (block && block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA) && block->pprev->nTx > 0 && pindexRescan != block)
block = block->pprev;
int block_height = *tip_height;
while (block_height > 0 && locked_chain->haveBlockOnDisk(block_height - 1) && rescan_height != block_height) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use findPruned(rescan_height, *tip_height)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #14711 (comment)

Why not use findPruned

I used haveBlockOnDisk here because I was doing a very literal translation and findPruned doesn't have the block->pprev->nTx > 0 condition. If can drop that condition or add it to findPruned, though, if it would be an improvement.

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.

@@ -366,8 +366,7 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
if (merkleBlock.txn.ExtractMatches(vMatch, vIndex) == merkleBlock.header.hashMerkleRoot) {

auto locked_chain = pwallet->chain().lock();
const CBlockIndex* pindex = LookupBlockIndex(merkleBlock.header.GetHash());
if (!pindex || !chainActive.Contains(pindex)) {
if (!locked_chain->getBlockHeight(merkleBlock.header.GetHash())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds wrong, as if it wants to discard genesis block (height == 0). Only got it after seeing the return type Optional<int>. IMO .contains(hash) would be preferable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be more clear with a comparison with nullopt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #14711 (comment)

Could be more clear with a comparison with nullopt

Took suggestion

@@ -1526,24 +1529,18 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

const CBlockIndex* pindex = nullptr; // Block index of the specified block or the common ancestor, if the block provided was in a deactivated chain.
const CBlockIndex* paltindex = nullptr; // Block index of the specified block, even if it's in a deactivated chain.
Optional<int> height; // Height of the specified block or the common ancestor, if the block provided was in a deactivated chain.
Copy link
Contributor

@promag promag Nov 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this change conceptually different? Even though the chain is locked, this can be copied and used without the lock and therefore can "point" to other block if a reorg occurs. This wouldn't occur with CBlockIndex.

Looks like you could either:

  • create interfaces::BlockIndex
  • replace CBlockIndex* with uint256.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #14711 (comment)

Isn't this change conceptually different?

I think so, a height is conceptually different from a block pointer.

Looks like you could either:

When the chain is locked, a height uniquely identifies a block, so many locked_chain methods take height arguments. I think it would good to eliminate these calls entirely (#10973 (comment)) and not very useful to tweak data types and just hide the fact that the chain is locked.

But either way, I want the API to change in the future and become nicer, more minimal, and more useful over time. Right now the API just reflects how the wallet currently works, to keep changes to wallet code in this PR as minimal as possible.

int64_t* max_time = nullptr) = 0;

//! Estimate fraction of total transactions verified if blocks up to
//! given height are verified.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc-nit: height is not given (at least not directly)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #14711 (comment)

doc-nit: height is not given (at least not directly)

Thanks, fixed comment

@jonasschnelli
Copy link
Contributor

Strong Concept ACK
Plans to review...

@Empact
Copy link
Contributor

Empact commented Jan 8, 2019

@ryanofsky I went ahead and split this up into a few commits, found it easier to review. Built and ran tests on each commit. https://github.com/Empact/bitcoin/tree/pr/wchain2

#include <util/system.h>
#include <validation.h>

#include <memory>
#include <unordered_map>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I believe this belongs in validation.h, as unordered_map isn't used directly here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #14711 (comment)

nit: I believe this belongs in validation.h, as unordered_map isn't used directly here.

This was added by IWYU because unordered map methods are called here. In theory this allows validation.h to switch to forward declarations and drop its unordered_map include without this file having to change. I don't think IWYU rationale is completely airtight (particularly in this case where validation.h might change mapBlockIndex into a different type of map with the same methods), but I like the IWYU tool, and don't think its worth spending a lot of time to analyze its decisions absent a compelling reason.

@@ -35,6 +150,34 @@ class ChainImpl : public Chain
return std::move(result);
}
std::unique_ptr<Chain::Lock> assumeLocked() override { return MakeUnique<LockImpl>(); }
bool findBlock(const uint256& hash, CBlock* block, int64_t* time, int64_t* time_max) override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: none of the callers use more than one of the out args, so splitting this up would make the call sites simpler/clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #14711 (comment)

nit: none of the callers use more than one of the out args, so splitting this up would make the call sites simpler/clearer.

There are many ways to design this API, and I just opted for one here that I thought would keep chain.h a little shorter and more organized, at the expense of being more verbose at call sites. If you have a specific alternative in mind and want to convince me or another reviewer that it's better, I'd be happy to adopt it here, or review a followup PR.

CWallet::ScanResult result =
pwallet->ScanForWalletTransactions(pindexStart, pindexStop, reserver, failed_block, stopBlock, true);
pwallet->ScanForWalletTransactions(start_block, stop_block, reserver, failed_block, stopBlock, true /* prune */);
Copy link
Contributor

@Empact Empact Jan 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stop_block and stopBlock are confusingly similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #14711 (comment)

stop_block and stopBlock are confusingly similar.

Added more renames

@ryanofsky
Copy link
Contributor Author

ryanofsky commented Jan 8, 2019

Thanks @Empact! I reset the PR to your branch.


Rebased d568bdb -> 5cad675 (pr/wchain2.1 -> pr/wchain2.2) due to conflict with #14380
Rebased 5cad675 -> 591c2c8 (pr/wchain2.2 -> pr/wchain2.3) due to conflict with #13076
Rebased 591c2c8 -> 939a400 (pr/wchain2.3 -> pr/wchain2.4) due to conflict with #14957
Split 939a400 -> 7a87272 (pr/wchain2.4 -> pr/wchain2.5) resetting to Empact:pr/wchain2 (no diffs)
Rebased 7a87272 -> ca76bcc (pr/wchain2.5 -> pr/wchain2.6) due to conflict with #15039

ariard pushed a commit to ariard/bitcoin that referenced this pull request Mar 27, 2019
…eAndHeight

As suggested in bitcoin#14711, pass height to CChain::FindEarliestAtLeast to
simplify Chain interface by combining findFirstBlockWithTime and
findFirstBlockWithTimeAndHeight into one

Extend findearliestatleast_edge_test in consequence
maflcko pushed a commit that referenced this pull request Apr 19, 2019
…stBlockWithTimeAndHeight

765c0b3 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 765c0b3. Nice work @ariard!
  ryanofsky:
    utACK 765c0b3. Looks good, thanks for implementing the suggestion!

Tree-SHA512: 63f98252a93da95f08c0b6325ea98f717aa9ae4036d17eaa6edbec68e5ddd65672d66a6af267b80c36311fffa9b415a47308e95ea7718b300b685e23d4e9e6ec
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Aug 30, 2019
…eAndHeight

As suggested in bitcoin#14711, pass height to CChain::FindEarliestAtLeast to
simplify Chain interface by combining findFirstBlockWithTime and
findFirstBlockWithTimeAndHeight into one

Extend findearliestatleast_edge_test in consequence
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Apr 10, 2020
Summary:
```
This change removes uses of chainActive and mapBlockIndex globals in
wallet code. It is a refactoring change which does not affect external
behavior.
```

Backport of core [[bitcoin/bitcoin#14711 | PR14711]].

Test Plan:
  ninja all check-extended

Ran the tests with UBSAN and ASAN as well.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D5683
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Aug 17, 2020
Summary:
```
This change removes uses of chainActive and mapBlockIndex globals in
wallet code. It is a refactoring change which does not affect external
behavior.
```

Backport of core [[bitcoin/bitcoin#14711 | PR14711]].

Test Plan:
  ninja all check-extended

Ran the tests with UBSAN and ASAN as well.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D5683
kwvg added a commit to kwvg/dash that referenced this pull request Oct 16, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 16, 2021
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 23, 2021
…wallet code

44de156 Remove remaining chainActive references from CWallet (Russell Yanofsky)
db21f02 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis (Russell Yanofsky)
2ffb079 Add findFork and findBlock to the Chain interface (Russell Yanofsky)
d93c4c1 Add time methods to the Chain interface (Russell Yanofsky)
700c42b Add height, depth, and hash methods to the Chain interface (Russell Yanofsky)

Pull request description:

  This change removes uses of `chainActive` and `mapBlockIndex` globals in wallet code. It is a refactoring change which does not affect external behavior.

  This is the next step in the larger bitcoin#10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in bitcoin#10102.

Tree-SHA512: 4dcec8a31c458f54e2ea6ecf01e430469b0994c5b41a21a2d150efa67cd209f4c93ae210a101e064b3a87c52c6edfc70b070e979992be0e3a00fd425de6230a8

# Conflicts:
#	src/Makefile.am
#	src/interfaces/wallet.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/rpcdump.cpp
#	src/wallet/rpcwallet.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
#	src/wallet/wallet.h
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 23, 2021
aebafd0 Rename Chain getLocator -> getTipLocator (Russell Yanofsky)
2c1fbaa Drop redundant get_value_or (Russell Yanofsky)
84adb20 Fix ScanForWalletTransactions start_block comment (Russell Yanofsky)
2efa66b Document rescanblockchain returned stop_height being null (Russell Yanofsky)
db2d093 Add suggested rescanblockchain comments (Russell Yanofsky)
a8d645c Update ScanForWalletTransactions result comment (Russell Yanofsky)
95a812b Rename ScanResult stop_block field (Russell Yanofsky)

Pull request description:

  This implements suggested changes from bitcoin#14711 review comments that didn't make make it in before merging.

  There are no changes in behavior in this PR, just documentation updates, simplifications, and variable renames.

Tree-SHA512: 39f1a5718195732b70b5e427c3b3e4295ea5af6328a5991763a422051212dfb95383186db0c0504ce2c2782fb61998dfd2fe9851645b7cb4e75d849049483cc8

# Conflicts:
#	src/interfaces/chain.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 24, 2021
…wallet code

44de156 Remove remaining chainActive references from CWallet (Russell Yanofsky)
db21f02 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis (Russell Yanofsky)
2ffb079 Add findFork and findBlock to the Chain interface (Russell Yanofsky)
d93c4c1 Add time methods to the Chain interface (Russell Yanofsky)
700c42b Add height, depth, and hash methods to the Chain interface (Russell Yanofsky)

Pull request description:

  This change removes uses of `chainActive` and `mapBlockIndex` globals in wallet code. It is a refactoring change which does not affect external behavior.

  This is the next step in the larger bitcoin#10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in bitcoin#10102.

Tree-SHA512: 4dcec8a31c458f54e2ea6ecf01e430469b0994c5b41a21a2d150efa67cd209f4c93ae210a101e064b3a87c52c6edfc70b070e979992be0e3a00fd425de6230a8

# Conflicts:
#	src/Makefile.am
#	src/interfaces/wallet.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/rpcdump.cpp
#	src/wallet/rpcwallet.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
#	src/wallet/wallet.h
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 24, 2021
aebafd0 Rename Chain getLocator -> getTipLocator (Russell Yanofsky)
2c1fbaa Drop redundant get_value_or (Russell Yanofsky)
84adb20 Fix ScanForWalletTransactions start_block comment (Russell Yanofsky)
2efa66b Document rescanblockchain returned stop_height being null (Russell Yanofsky)
db2d093 Add suggested rescanblockchain comments (Russell Yanofsky)
a8d645c Update ScanForWalletTransactions result comment (Russell Yanofsky)
95a812b Rename ScanResult stop_block field (Russell Yanofsky)

Pull request description:

  This implements suggested changes from bitcoin#14711 review comments that didn't make make it in before merging.

  There are no changes in behavior in this PR, just documentation updates, simplifications, and variable renames.

Tree-SHA512: 39f1a5718195732b70b5e427c3b3e4295ea5af6328a5991763a422051212dfb95383186db0c0504ce2c2782fb61998dfd2fe9851645b7cb4e75d849049483cc8

# Conflicts:
#	src/interfaces/chain.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 25, 2021
…wallet code

44de156 Remove remaining chainActive references from CWallet (Russell Yanofsky)
db21f02 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis (Russell Yanofsky)
2ffb079 Add findFork and findBlock to the Chain interface (Russell Yanofsky)
d93c4c1 Add time methods to the Chain interface (Russell Yanofsky)
700c42b Add height, depth, and hash methods to the Chain interface (Russell Yanofsky)

Pull request description:

  This change removes uses of `chainActive` and `mapBlockIndex` globals in wallet code. It is a refactoring change which does not affect external behavior.

  This is the next step in the larger bitcoin#10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in bitcoin#10102.

Tree-SHA512: 4dcec8a31c458f54e2ea6ecf01e430469b0994c5b41a21a2d150efa67cd209f4c93ae210a101e064b3a87c52c6edfc70b070e979992be0e3a00fd425de6230a8

# Conflicts:
#	src/Makefile.am
#	src/interfaces/wallet.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/rpcdump.cpp
#	src/wallet/rpcwallet.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
#	src/wallet/wallet.h
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 25, 2021
aebafd0 Rename Chain getLocator -> getTipLocator (Russell Yanofsky)
2c1fbaa Drop redundant get_value_or (Russell Yanofsky)
84adb20 Fix ScanForWalletTransactions start_block comment (Russell Yanofsky)
2efa66b Document rescanblockchain returned stop_height being null (Russell Yanofsky)
db2d093 Add suggested rescanblockchain comments (Russell Yanofsky)
a8d645c Update ScanForWalletTransactions result comment (Russell Yanofsky)
95a812b Rename ScanResult stop_block field (Russell Yanofsky)

Pull request description:

  This implements suggested changes from bitcoin#14711 review comments that didn't make make it in before merging.

  There are no changes in behavior in this PR, just documentation updates, simplifications, and variable renames.

Tree-SHA512: 39f1a5718195732b70b5e427c3b3e4295ea5af6328a5991763a422051212dfb95383186db0c0504ce2c2782fb61998dfd2fe9851645b7cb4e75d849049483cc8

# Conflicts:
#	src/interfaces/chain.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 25, 2021
…wallet code

44de156 Remove remaining chainActive references from CWallet (Russell Yanofsky)
db21f02 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis (Russell Yanofsky)
2ffb079 Add findFork and findBlock to the Chain interface (Russell Yanofsky)
d93c4c1 Add time methods to the Chain interface (Russell Yanofsky)
700c42b Add height, depth, and hash methods to the Chain interface (Russell Yanofsky)

Pull request description:

  This change removes uses of `chainActive` and `mapBlockIndex` globals in wallet code. It is a refactoring change which does not affect external behavior.

  This is the next step in the larger bitcoin#10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in bitcoin#10102.

Tree-SHA512: 4dcec8a31c458f54e2ea6ecf01e430469b0994c5b41a21a2d150efa67cd209f4c93ae210a101e064b3a87c52c6edfc70b070e979992be0e3a00fd425de6230a8

# Conflicts:
#	src/Makefile.am
#	src/interfaces/wallet.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/rpcdump.cpp
#	src/wallet/rpcwallet.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
#	src/wallet/wallet.h
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 25, 2021
aebafd0 Rename Chain getLocator -> getTipLocator (Russell Yanofsky)
2c1fbaa Drop redundant get_value_or (Russell Yanofsky)
84adb20 Fix ScanForWalletTransactions start_block comment (Russell Yanofsky)
2efa66b Document rescanblockchain returned stop_height being null (Russell Yanofsky)
db2d093 Add suggested rescanblockchain comments (Russell Yanofsky)
a8d645c Update ScanForWalletTransactions result comment (Russell Yanofsky)
95a812b Rename ScanResult stop_block field (Russell Yanofsky)

Pull request description:

  This implements suggested changes from bitcoin#14711 review comments that didn't make make it in before merging.

  There are no changes in behavior in this PR, just documentation updates, simplifications, and variable renames.

Tree-SHA512: 39f1a5718195732b70b5e427c3b3e4295ea5af6328a5991763a422051212dfb95383186db0c0504ce2c2782fb61998dfd2fe9851645b7cb4e75d849049483cc8

# Conflicts:
#	src/interfaces/chain.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
kwvg pushed a commit to kwvg/dash that referenced this pull request Oct 31, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 31, 2021
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Nov 1, 2021
…wallet code

44de156 Remove remaining chainActive references from CWallet (Russell Yanofsky)
db21f02 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis (Russell Yanofsky)
2ffb079 Add findFork and findBlock to the Chain interface (Russell Yanofsky)
d93c4c1 Add time methods to the Chain interface (Russell Yanofsky)
700c42b Add height, depth, and hash methods to the Chain interface (Russell Yanofsky)

Pull request description:

  This change removes uses of `chainActive` and `mapBlockIndex` globals in wallet code. It is a refactoring change which does not affect external behavior.

  This is the next step in the larger bitcoin#10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in bitcoin#10102.

Tree-SHA512: 4dcec8a31c458f54e2ea6ecf01e430469b0994c5b41a21a2d150efa67cd209f4c93ae210a101e064b3a87c52c6edfc70b070e979992be0e3a00fd425de6230a8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Nov 1, 2021
aebafd0 Rename Chain getLocator -> getTipLocator (Russell Yanofsky)
2c1fbaa Drop redundant get_value_or (Russell Yanofsky)
84adb20 Fix ScanForWalletTransactions start_block comment (Russell Yanofsky)
2efa66b Document rescanblockchain returned stop_height being null (Russell Yanofsky)
db2d093 Add suggested rescanblockchain comments (Russell Yanofsky)
a8d645c Update ScanForWalletTransactions result comment (Russell Yanofsky)
95a812b Rename ScanResult stop_block field (Russell Yanofsky)

Pull request description:

  This implements suggested changes from bitcoin#14711 review comments that didn't make make it in before merging.

  There are no changes in behavior in this PR, just documentation updates, simplifications, and variable renames.

Tree-SHA512: 39f1a5718195732b70b5e427c3b3e4295ea5af6328a5991763a422051212dfb95383186db0c0504ce2c2782fb61998dfd2fe9851645b7cb4e75d849049483cc8

# Conflicts:
#	src/interfaces/chain.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Nov 1, 2021
…wallet code

44de156 Remove remaining chainActive references from CWallet (Russell Yanofsky)
db21f02 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis (Russell Yanofsky)
2ffb079 Add findFork and findBlock to the Chain interface (Russell Yanofsky)
d93c4c1 Add time methods to the Chain interface (Russell Yanofsky)
700c42b Add height, depth, and hash methods to the Chain interface (Russell Yanofsky)

Pull request description:

  This change removes uses of `chainActive` and `mapBlockIndex` globals in wallet code. It is a refactoring change which does not affect external behavior.

  This is the next step in the larger bitcoin#10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in bitcoin#10102.

Tree-SHA512: 4dcec8a31c458f54e2ea6ecf01e430469b0994c5b41a21a2d150efa67cd209f4c93ae210a101e064b3a87c52c6edfc70b070e979992be0e3a00fd425de6230a8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Nov 1, 2021
aebafd0 Rename Chain getLocator -> getTipLocator (Russell Yanofsky)
2c1fbaa Drop redundant get_value_or (Russell Yanofsky)
84adb20 Fix ScanForWalletTransactions start_block comment (Russell Yanofsky)
2efa66b Document rescanblockchain returned stop_height being null (Russell Yanofsky)
db2d093 Add suggested rescanblockchain comments (Russell Yanofsky)
a8d645c Update ScanForWalletTransactions result comment (Russell Yanofsky)
95a812b Rename ScanResult stop_block field (Russell Yanofsky)

Pull request description:

  This implements suggested changes from bitcoin#14711 review comments that didn't make make it in before merging.

  There are no changes in behavior in this PR, just documentation updates, simplifications, and variable renames.

Tree-SHA512: 39f1a5718195732b70b5e427c3b3e4295ea5af6328a5991763a422051212dfb95383186db0c0504ce2c2782fb61998dfd2fe9851645b7cb4e75d849049483cc8

# Conflicts:
#	src/interfaces/chain.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Nov 3, 2021
…wallet code

44de156 Remove remaining chainActive references from CWallet (Russell Yanofsky)
db21f02 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis (Russell Yanofsky)
2ffb079 Add findFork and findBlock to the Chain interface (Russell Yanofsky)
d93c4c1 Add time methods to the Chain interface (Russell Yanofsky)
700c42b Add height, depth, and hash methods to the Chain interface (Russell Yanofsky)

Pull request description:

  This change removes uses of `chainActive` and `mapBlockIndex` globals in wallet code. It is a refactoring change which does not affect external behavior.

  This is the next step in the larger bitcoin#10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in bitcoin#10102.

Tree-SHA512: 4dcec8a31c458f54e2ea6ecf01e430469b0994c5b41a21a2d150efa67cd209f4c93ae210a101e064b3a87c52c6edfc70b070e979992be0e3a00fd425de6230a8
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Nov 3, 2021
aebafd0 Rename Chain getLocator -> getTipLocator (Russell Yanofsky)
2c1fbaa Drop redundant get_value_or (Russell Yanofsky)
84adb20 Fix ScanForWalletTransactions start_block comment (Russell Yanofsky)
2efa66b Document rescanblockchain returned stop_height being null (Russell Yanofsky)
db2d093 Add suggested rescanblockchain comments (Russell Yanofsky)
a8d645c Update ScanForWalletTransactions result comment (Russell Yanofsky)
95a812b Rename ScanResult stop_block field (Russell Yanofsky)

Pull request description:

  This implements suggested changes from bitcoin#14711 review comments that didn't make make it in before merging.

  There are no changes in behavior in this PR, just documentation updates, simplifications, and variable renames.

Tree-SHA512: 39f1a5718195732b70b5e427c3b3e4295ea5af6328a5991763a422051212dfb95383186db0c0504ce2c2782fb61998dfd2fe9851645b7cb4e75d849049483cc8

# Conflicts:
#	src/interfaces/chain.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
pravblockc pushed a commit to pravblockc/dash that referenced this pull request Nov 18, 2021
…wallet code

44de156 Remove remaining chainActive references from CWallet (Russell Yanofsky)
db21f02 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis (Russell Yanofsky)
2ffb079 Add findFork and findBlock to the Chain interface (Russell Yanofsky)
d93c4c1 Add time methods to the Chain interface (Russell Yanofsky)
700c42b Add height, depth, and hash methods to the Chain interface (Russell Yanofsky)

Pull request description:

  This change removes uses of `chainActive` and `mapBlockIndex` globals in wallet code. It is a refactoring change which does not affect external behavior.

  This is the next step in the larger bitcoin#10973 refactoring change, which removes all other accesses to node global variables from wallet code. Doing this is useful to provide a better defined interface between the wallet and node, and necessary to allow wallet and node code to run in separate processes in bitcoin#10102.

Tree-SHA512: 4dcec8a31c458f54e2ea6ecf01e430469b0994c5b41a21a2d150efa67cd209f4c93ae210a101e064b3a87c52c6edfc70b070e979992be0e3a00fd425de6230a8
pravblockc pushed a commit to pravblockc/dash that referenced this pull request Nov 18, 2021
aebafd0 Rename Chain getLocator -> getTipLocator (Russell Yanofsky)
2c1fbaa Drop redundant get_value_or (Russell Yanofsky)
84adb20 Fix ScanForWalletTransactions start_block comment (Russell Yanofsky)
2efa66b Document rescanblockchain returned stop_height being null (Russell Yanofsky)
db2d093 Add suggested rescanblockchain comments (Russell Yanofsky)
a8d645c Update ScanForWalletTransactions result comment (Russell Yanofsky)
95a812b Rename ScanResult stop_block field (Russell Yanofsky)

Pull request description:

  This implements suggested changes from bitcoin#14711 review comments that didn't make make it in before merging.

  There are no changes in behavior in this PR, just documentation updates, simplifications, and variable renames.

Tree-SHA512: 39f1a5718195732b70b5e427c3b3e4295ea5af6328a5991763a422051212dfb95383186db0c0504ce2c2782fb61998dfd2fe9851645b7cb4e75d849049483cc8

# Conflicts:
#	src/interfaces/chain.cpp
#	src/qt/test/wallettests.cpp
#	src/wallet/test/wallet_tests.cpp
#	src/wallet/wallet.cpp
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.