aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/test/wallet_tests.cpp
diff options
context:
space:
mode:
authorS3RK <1466284+S3RK@users.noreply.github.com>2022-01-17 08:54:08 +0100
committerS3RK <1466284+S3RK@users.noreply.github.com>2022-01-17 08:54:08 +0100
commit3b98bf9c43ece060d57d7ae31624d4a8220de266 (patch)
tree878d22c51caf9bf1ac9a90b824f5ecd6b17dc7f4 /src/wallet/test/wallet_tests.cpp
parentdbf81a73e37141f86a65a0f96ff0f740f74ec045 (diff)
downloadbitcoin-3b98bf9c43ece060d57d7ae31624d4a8220de266.tar.xz
Revert "Add to spends only transcations from me"
This reverts commit d04566415e16ae685af066384f346dff522c068f.
Diffstat (limited to 'src/wallet/test/wallet_tests.cpp')
-rw-r--r--src/wallet/test/wallet_tests.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
index bb6021b857..55428f43a7 100644
--- a/src/wallet/test/wallet_tests.cpp
+++ b/src/wallet/test/wallet_tests.cpp
@@ -820,35 +820,30 @@ BOOST_FIXTURE_TEST_CASE(ZapSelectTx, TestChain100Setup)
context.args = &gArgs;
context.chain = m_node.chain.get();
auto wallet = TestLoadWallet(context);
- AddKey(*wallet, coinbaseKey);
+ CKey key;
+ key.MakeNewKey(true);
+ AddKey(*wallet, key);
- // rescan to ensure coinbase transactions from test fixture are picked up by the wallet
- {
- WalletRescanReserver reserver(*wallet);
- reserver.reserve();
- wallet->ScanForWalletTransactions(m_node.chain->getBlockHash(0), 0, /* max height= */ {}, reserver, /* update= */ true);
- }
- // create one more block to get the first block coinbase to maturity
+ std::string error;
m_coinbase_txns.push_back(CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
- // spend first coinbase tx
- auto spend_tx = TestSimpleSpend(*m_coinbase_txns[0], 0, coinbaseKey, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
- CreateAndProcessBlock({spend_tx}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
+ auto block_tx = TestSimpleSpend(*m_coinbase_txns[0], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
+ CreateAndProcessBlock({block_tx}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
SyncWithValidationInterfaceQueue();
{
- auto spend_tx_hash = spend_tx.GetHash();
+ auto block_hash = block_tx.GetHash();
auto prev_hash = m_coinbase_txns[0]->GetHash();
LOCK(wallet->cs_wallet);
BOOST_CHECK(wallet->HasWalletSpend(prev_hash));
- BOOST_CHECK_EQUAL(wallet->mapWallet.count(spend_tx_hash), 1u);
+ BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 1u);
- std::vector<uint256> vHashIn{spend_tx_hash}, vHashOut;
+ std::vector<uint256> vHashIn{ block_hash }, vHashOut;
BOOST_CHECK_EQUAL(wallet->ZapSelectTx(vHashIn, vHashOut), DBErrors::LOAD_OK);
BOOST_CHECK(!wallet->HasWalletSpend(prev_hash));
- BOOST_CHECK_EQUAL(wallet->mapWallet.count(spend_tx_hash), 0u);
+ BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 0u);
}
TestUnloadWallet(std::move(wallet));