mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-01 11:26:03 +02:00
refactor: Simplify extra_txn to be a vec of CTransactionRef instead of a vec of pair<Wtxid, CTransactionRef>
All `CTransactionRef` have `.GetWitnessHash()` that returns a cached `const Wtxid` (since fac1223a56),
so we don't need to pass transaction refs around with their IDs as they're easy to get from a ref.
This commit is contained in:
@@ -1006,7 +1006,7 @@ private:
|
||||
/** Orphan/conflicted/etc transactions that are kept for compact block reconstruction.
|
||||
* The last -blockreconstructionextratxn/DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN of
|
||||
* these are kept in a ring buffer */
|
||||
std::vector<std::pair<Wtxid, CTransactionRef>> vExtraTxnForCompact GUARDED_BY(g_msgproc_mutex);
|
||||
std::vector<CTransactionRef> vExtraTxnForCompact GUARDED_BY(g_msgproc_mutex);
|
||||
/** Offset into vExtraTxnForCompact to insert the next tx */
|
||||
size_t vExtraTxnForCompactIt GUARDED_BY(g_msgproc_mutex) = 0;
|
||||
|
||||
@@ -1802,7 +1802,7 @@ void PeerManagerImpl::AddToCompactExtraTransactions(const CTransactionRef& tx)
|
||||
return;
|
||||
if (!vExtraTxnForCompact.size())
|
||||
vExtraTxnForCompact.resize(m_opts.max_extra_txs);
|
||||
vExtraTxnForCompact[vExtraTxnForCompactIt] = std::make_pair(tx->GetWitnessHash(), tx);
|
||||
vExtraTxnForCompact[vExtraTxnForCompactIt] = tx;
|
||||
vExtraTxnForCompactIt = (vExtraTxnForCompactIt + 1) % m_opts.max_extra_txs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user