@@ -820,35 +820,30 @@ BOOST_FIXTURE_TEST_CASE(ZapSelectTx, TestChain100Setup)
820
820
context.args = &gArgs ;
821
821
context.chain = m_node.chain .get ();
822
822
auto wallet = TestLoadWallet (context);
823
- AddKey (*wallet, coinbaseKey);
823
+ CKey key;
824
+ key.MakeNewKey (true );
825
+ AddKey (*wallet, key);
824
826
825
- // rescan to ensure coinbase transactions from test fixture are picked up by the wallet
826
- {
827
- WalletRescanReserver reserver (*wallet);
828
- reserver.reserve ();
829
- wallet->ScanForWalletTransactions (m_node.chain ->getBlockHash (0 ), 0 , /* max height= */ {}, reserver, /* update= */ true );
830
- }
831
- // create one more block to get the first block coinbase to maturity
827
+ std::string error;
832
828
m_coinbase_txns.push_back (CreateAndProcessBlock ({}, GetScriptForRawPubKey (coinbaseKey.GetPubKey ())).vtx [0 ]);
833
- // spend first coinbase tx
834
- auto spend_tx = TestSimpleSpend (*m_coinbase_txns[0 ], 0 , coinbaseKey, GetScriptForRawPubKey (coinbaseKey.GetPubKey ()));
835
- CreateAndProcessBlock ({spend_tx}, GetScriptForRawPubKey (coinbaseKey.GetPubKey ()));
829
+ auto block_tx = TestSimpleSpend (*m_coinbase_txns[0 ], 0 , coinbaseKey, GetScriptForRawPubKey (key.GetPubKey ()));
830
+ CreateAndProcessBlock ({block_tx}, GetScriptForRawPubKey (coinbaseKey.GetPubKey ()));
836
831
837
832
SyncWithValidationInterfaceQueue ();
838
833
839
834
{
840
- auto spend_tx_hash = spend_tx .GetHash ();
835
+ auto block_hash = block_tx .GetHash ();
841
836
auto prev_hash = m_coinbase_txns[0 ]->GetHash ();
842
837
843
838
LOCK (wallet->cs_wallet );
844
839
BOOST_CHECK (wallet->HasWalletSpend (prev_hash));
845
- BOOST_CHECK_EQUAL (wallet->mapWallet .count (spend_tx_hash ), 1u );
840
+ BOOST_CHECK_EQUAL (wallet->mapWallet .count (block_hash ), 1u );
846
841
847
- std::vector<uint256> vHashIn{spend_tx_hash }, vHashOut;
842
+ std::vector<uint256> vHashIn{ block_hash }, vHashOut;
848
843
BOOST_CHECK_EQUAL (wallet->ZapSelectTx (vHashIn, vHashOut), DBErrors::LOAD_OK);
849
844
850
845
BOOST_CHECK (!wallet->HasWalletSpend (prev_hash));
851
- BOOST_CHECK_EQUAL (wallet->mapWallet .count (spend_tx_hash ), 0u );
846
+ BOOST_CHECK_EQUAL (wallet->mapWallet .count (block_hash ), 0u );
852
847
}
853
848
854
849
TestUnloadWallet (std::move (wallet));
0 commit comments