mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
tidy: modernize-use-emplace
This commit is contained in:
@@ -49,7 +49,7 @@ BOOST_FIXTURE_TEST_SUITE(wallet_tests, WalletTestingSetup)
|
||||
static CMutableTransaction TestSimpleSpend(const CTransaction& from, uint32_t index, const CKey& key, const CScript& pubkey)
|
||||
{
|
||||
CMutableTransaction mtx;
|
||||
mtx.vout.push_back({from.vout[index].nValue - DEFAULT_TRANSACTION_MAXFEE, pubkey});
|
||||
mtx.vout.emplace_back(from.vout[index].nValue - DEFAULT_TRANSACTION_MAXFEE, pubkey);
|
||||
mtx.vin.push_back({CTxIn{from.GetHash(), index}});
|
||||
FillableSigningProvider keystore;
|
||||
keystore.AddKey(key);
|
||||
@@ -945,8 +945,8 @@ BOOST_FIXTURE_TEST_CASE(wallet_sync_tx_invalid_state_test, TestingSetup)
|
||||
const auto op_dest{*Assert(wallet.GetNewDestination(OutputType::BECH32M, ""))};
|
||||
|
||||
CMutableTransaction mtx;
|
||||
mtx.vout.push_back({COIN, GetScriptForDestination(op_dest)});
|
||||
mtx.vin.push_back(CTxIn(g_insecure_rand_ctx.rand256(), 0));
|
||||
mtx.vout.emplace_back(COIN, GetScriptForDestination(op_dest));
|
||||
mtx.vin.emplace_back(g_insecure_rand_ctx.rand256(), 0);
|
||||
const auto& tx_id_to_spend = wallet.AddToWallet(MakeTransactionRef(mtx), TxStateInMempool{})->GetHash();
|
||||
|
||||
{
|
||||
@@ -961,7 +961,7 @@ BOOST_FIXTURE_TEST_CASE(wallet_sync_tx_invalid_state_test, TestingSetup)
|
||||
// 2) Verify that the available balance of this new tx and the old one is updated (prev tx is marked dirty)
|
||||
|
||||
mtx.vin.clear();
|
||||
mtx.vin.push_back(CTxIn(tx_id_to_spend, 0));
|
||||
mtx.vin.emplace_back(tx_id_to_spend, 0);
|
||||
wallet.transactionAddedToMempool(MakeTransactionRef(mtx));
|
||||
const uint256& good_tx_id = mtx.GetHash();
|
||||
|
||||
@@ -982,7 +982,7 @@ BOOST_FIXTURE_TEST_CASE(wallet_sync_tx_invalid_state_test, TestingSetup)
|
||||
// verify that we are not moving forward if the wallet cannot store it
|
||||
GetMockableDatabase(wallet).m_pass = false;
|
||||
mtx.vin.clear();
|
||||
mtx.vin.push_back(CTxIn(good_tx_id, 0));
|
||||
mtx.vin.emplace_back(good_tx_id, 0);
|
||||
BOOST_CHECK_EXCEPTION(wallet.transactionAddedToMempool(MakeTransactionRef(mtx)),
|
||||
std::runtime_error,
|
||||
HasReason("DB error adding transaction to wallet, write failed"));
|
||||
|
||||
Reference in New Issue
Block a user