@@ -787,4 +787,37 @@ BOOST_FIXTURE_TEST_CASE(CreateWalletFromFile, TestChain100Setup)
787
787
TestUnloadWallet (std::move (wallet));
788
788
}
789
789
790
+ BOOST_FIXTURE_TEST_CASE (ZapSelectTx, TestChain100Setup)
791
+ {
792
+ auto chain = interfaces::MakeChain (m_node);
793
+ auto wallet = TestLoadWallet (*chain);
794
+ CKey key;
795
+ key.MakeNewKey (true );
796
+ AddKey (*wallet, key);
797
+
798
+ std::string error;
799
+ m_coinbase_txns.push_back (CreateAndProcessBlock ({}, GetScriptForRawPubKey (coinbaseKey.GetPubKey ())).vtx [0 ]);
800
+ auto block_tx = TestSimpleSpend (*m_coinbase_txns[0 ], 0 , coinbaseKey, GetScriptForRawPubKey (key.GetPubKey ()));
801
+ CreateAndProcessBlock ({block_tx}, GetScriptForRawPubKey (coinbaseKey.GetPubKey ()));
802
+
803
+ SyncWithValidationInterfaceQueue ();
804
+
805
+ {
806
+ auto block_hash = block_tx.GetHash ();
807
+ auto prev_hash = m_coinbase_txns[0 ]->GetHash ();
808
+
809
+ LOCK (wallet->cs_wallet );
810
+ BOOST_CHECK (wallet->HasWalletSpend (prev_hash));
811
+ BOOST_CHECK_EQUAL (wallet->mapWallet .count (block_hash), 1 );
812
+
813
+ std::vector<uint256> vHashIn{ block_hash }, vHashOut;
814
+ BOOST_CHECK_EQUAL (wallet->ZapSelectTx (vHashIn, vHashOut), DBErrors::LOAD_OK);
815
+
816
+ BOOST_CHECK (!wallet->HasWalletSpend (prev_hash));
817
+ BOOST_CHECK_EQUAL (wallet->mapWallet .count (block_hash), 0 );
818
+ }
819
+
820
+ TestUnloadWallet (std::move (wallet));
821
+ }
822
+
790
823
BOOST_AUTO_TEST_SUITE_END ()
0 commit comments