Skip to content
Bitcoin Roots

v29.4-roots.2 · Commit 4: [PATCH 04/21] wallet: harden database and signing behavior

src/wallet/test/wallet_tests.cpp

Before: src/wallet/test/wallet_tests.cpp · After: src/wallet/test/wallet_tests.cpp

File metadata
index b5de4b4b3d3f0ae104d1bdfa2ba92a9353382bee..b0e1fa90f6accafb727227bef053e0f2e7a4a010 100644

Download original patch · Release notes

Diff rows 1–23 of 23. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/wallet/test/wallet_tests.cpp CHANGED
@@ -855,9 +855,10 @@ BOOST_FIXTURE_TEST_CASE(CreateWallet, TestChain100Setup)
855
855
  });
856
856
  std::string error;
857
857
  m_coinbase_txns.push_back(CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
858
- auto block_tx = TestSimpleSpend(*m_coinbase_txns[0], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
858
+ const CScript wallet_script{GetScriptForDestination(PKHash{key.GetPubKey()})};
859
+ auto block_tx = TestSimpleSpend(*m_coinbase_txns[0], 0, coinbaseKey, wallet_script);
859
860
  m_coinbase_txns.push_back(CreateAndProcessBlock({block_tx}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
860
- auto mempool_tx = TestSimpleSpend(*m_coinbase_txns[1], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
861
+ auto mempool_tx = TestSimpleSpend(*m_coinbase_txns[1], 0, coinbaseKey, wallet_script);
861
862
  BOOST_CHECK(m_node.chain->broadcastTransaction(MakeTransactionRef(mempool_tx), DEFAULT_TRANSACTION_MAXFEE, false, error));
862
863
 
863
864
 
@@ -897,9 +898,9 @@ BOOST_FIXTURE_TEST_CASE(CreateWallet, TestChain100Setup)
897
898
  auto handler = HandleLoadWallet(context, [&](std::unique_ptr<interfaces::Wallet> wallet) {
898
899
  BOOST_CHECK(rescan_completed);
899
900
  m_coinbase_txns.push_back(CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
900
- block_tx = TestSimpleSpend(*m_coinbase_txns[2], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
901
+ block_tx = TestSimpleSpend(*m_coinbase_txns[2], 0, coinbaseKey, wallet_script);
901
902
  m_coinbase_txns.push_back(CreateAndProcessBlock({block_tx}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
902
- mempool_tx = TestSimpleSpend(*m_coinbase_txns[3], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
903
+ mempool_tx = TestSimpleSpend(*m_coinbase_txns[3], 0, coinbaseKey, wallet_script);
903
904
  BOOST_CHECK(m_node.chain->broadcastTransaction(MakeTransactionRef(mempool_tx), DEFAULT_TRANSACTION_MAXFEE, false, error));
904
905
  m_node.validation_signals->SyncWithValidationInterfaceQueue();
905
906
  });