Skip to content
Bitcoin Roots

v29.4-roots.1 · Commit 4: [PATCH 04/13] 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. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

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