mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
Merge bitcoin/bitcoin#30093: optimization: reserve memory allocation for transaction inputs/outputs
ec585f11c3
Reserve space for transaction inputs in CreateTransactionInternal (Lőrinc)c76aaaf900
Reserve space for transaction outputs in CreateTransactionInternal (Lőrinc) Pull request description: Reserved memory for the transaction inputs and outputs. Split out of https://github.com/bitcoin/bitcoin/pull/30050/files#r1597631104 ACKs for top commit: achow101: ACKec585f11c3
TheCharlatan: ACKec585f11c3
stickies-v: ACKec585f11c3
Tree-SHA512: de399fb19824423467f48af64aa57f41a23cdd00eb17461e0131e4deafdd15e0d2daebf6a0a7ac7728b2fb486b2a54f1a7ef26bbe823c56b2a09f892f6b9a581
This commit is contained in:
commit
dea9fb9a8b
1 changed files with 2 additions and 0 deletions
|
@ -1167,6 +1167,7 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
|
|||
result.GetSelectedValue());
|
||||
|
||||
// vouts to the payees
|
||||
txNew.vout.reserve(vecSend.size() + 1); // + 1 because of possible later insert
|
||||
for (const auto& recipient : vecSend)
|
||||
{
|
||||
txNew.vout.emplace_back(recipient.nAmount, GetScriptForDestination(recipient.dest));
|
||||
|
@ -1217,6 +1218,7 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
|
|||
// behavior."
|
||||
bool use_anti_fee_sniping = true;
|
||||
const uint32_t default_sequence{coin_control.m_signal_bip125_rbf.value_or(wallet.m_signal_rbf) ? MAX_BIP125_RBF_SEQUENCE : CTxIn::MAX_SEQUENCE_NONFINAL};
|
||||
txNew.vin.reserve(selected_coins.size());
|
||||
for (const auto& coin : selected_coins) {
|
||||
std::optional<uint32_t> sequence = coin_control.GetSequence(coin->outpoint);
|
||||
if (sequence) {
|
||||
|
|
Loading…
Add table
Reference in a new issue