diff options
| author | Ben Woosley <[email protected]> | 2018-04-29 15:45:44 +0000 |
|---|---|---|
| committer | Ben Woosley <[email protected]> | 2018-11-13 00:04:13 -0500 |
| commit | 3002d6cf31821622e9f21d51e536cafc5cfb10ae (patch) | |
| tree | a0831d207b5ca61d08285ac71212929817e5d8d4 /src/wallet/test/wallet_tests.cpp | |
| parent | Make CWallet::ScanForWalletTransactions args and return value const (diff) | |
| download | discoin-3002d6cf31821622e9f21d51e536cafc5cfb10ae.tar.xz discoin-3002d6cf31821622e9f21d51e536cafc5cfb10ae.zip | |
Return a status enum from ScanForWalletTransactions
Return the failed block as an out var.
This clarifies the outcome as the prior return value could
be null due to user abort or failure.
Diffstat (limited to 'src/wallet/test/wallet_tests.cpp')
| -rw-r--r-- | src/wallet/test/wallet_tests.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index c6aac8aad..dccda1acf 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -38,7 +38,7 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup) auto chain = interfaces::MakeChain(); // Cap last block file size, and mine new block in a new block file. - CBlockIndex* const nullBlock = nullptr; + const CBlockIndex* const null_block = nullptr; CBlockIndex* oldTip = chainActive.Tip(); GetBlockFileInfo(oldTip->GetBlockPos().nFile)->nSize = MAX_BLOCKFILE_SIZE; CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())); @@ -53,7 +53,9 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup) AddKey(wallet, coinbaseKey); WalletRescanReserver reserver(&wallet); reserver.reserve(); - BOOST_CHECK_EQUAL(nullBlock, wallet.ScanForWalletTransactions(oldTip, nullptr, reserver)); + const CBlockIndex* stop_block; + BOOST_CHECK_EQUAL(wallet.ScanForWalletTransactions(oldTip, nullptr, reserver, stop_block), CWallet::ScanResult::SUCCESS); + BOOST_CHECK_EQUAL(stop_block, null_block); BOOST_CHECK_EQUAL(wallet.GetImmatureBalance(), 100 * COIN); } @@ -68,7 +70,9 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup) AddKey(wallet, coinbaseKey); WalletRescanReserver reserver(&wallet); reserver.reserve(); - BOOST_CHECK_EQUAL(oldTip, wallet.ScanForWalletTransactions(oldTip, nullptr, reserver)); + const CBlockIndex* stop_block; + BOOST_CHECK_EQUAL(wallet.ScanForWalletTransactions(oldTip, nullptr, reserver, stop_block), CWallet::ScanResult::FAILURE); + BOOST_CHECK_EQUAL(oldTip, stop_block); BOOST_CHECK_EQUAL(wallet.GetImmatureBalance(), 50 * COIN); } @@ -286,7 +290,10 @@ public: AddKey(*wallet, coinbaseKey); WalletRescanReserver reserver(wallet.get()); reserver.reserve(); - wallet->ScanForWalletTransactions(chainActive.Genesis(), nullptr, reserver); + const CBlockIndex* const null_block = nullptr; + const CBlockIndex* stop_block; + BOOST_CHECK_EQUAL(wallet->ScanForWalletTransactions(chainActive.Genesis(), nullptr, reserver, stop_block), CWallet::ScanResult::SUCCESS); + BOOST_CHECK_EQUAL(stop_block, null_block); } ~ListCoinsTestingSetup() |