mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
blockchain: avoid pointless transaction copy and temporary
This commit is contained in:
parent
07d655e438
commit
9827880877
1 changed files with 4 additions and 3 deletions
|
@ -3559,7 +3559,7 @@ leave:
|
||||||
txs.reserve(bl.tx_hashes.size());
|
txs.reserve(bl.tx_hashes.size());
|
||||||
for (const crypto::hash& tx_id : bl.tx_hashes)
|
for (const crypto::hash& tx_id : bl.tx_hashes)
|
||||||
{
|
{
|
||||||
transaction tx;
|
transaction tx_tmp;
|
||||||
blobdata txblob;
|
blobdata txblob;
|
||||||
size_t tx_weight = 0;
|
size_t tx_weight = 0;
|
||||||
uint64_t fee = 0;
|
uint64_t fee = 0;
|
||||||
|
@ -3580,7 +3580,7 @@ leave:
|
||||||
TIME_MEASURE_START(bb);
|
TIME_MEASURE_START(bb);
|
||||||
|
|
||||||
// get transaction with hash <tx_id> from tx_pool
|
// get transaction with hash <tx_id> from tx_pool
|
||||||
if(!m_tx_pool.take_tx(tx_id, tx, txblob, tx_weight, fee, relayed, do_not_relay, double_spend_seen))
|
if(!m_tx_pool.take_tx(tx_id, tx_tmp, txblob, tx_weight, fee, relayed, do_not_relay, double_spend_seen))
|
||||||
{
|
{
|
||||||
MERROR_VER("Block with id: " << id << " has at least one unknown transaction with id: " << tx_id);
|
MERROR_VER("Block with id: " << id << " has at least one unknown transaction with id: " << tx_id);
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
|
@ -3593,7 +3593,8 @@ leave:
|
||||||
// add the transaction to the temp list of transactions, so we can either
|
// add the transaction to the temp list of transactions, so we can either
|
||||||
// store the list of transactions all at once or return the ones we've
|
// store the list of transactions all at once or return the ones we've
|
||||||
// taken from the tx_pool back to it if the block fails verification.
|
// taken from the tx_pool back to it if the block fails verification.
|
||||||
txs.push_back(std::make_pair(tx, std::move(txblob)));
|
txs.push_back(std::make_pair(std::move(tx_tmp), std::move(txblob)));
|
||||||
|
transaction &tx = txs.back().first;
|
||||||
TIME_MEASURE_START(dd);
|
TIME_MEASURE_START(dd);
|
||||||
|
|
||||||
// FIXME: the storage should not be responsible for validation.
|
// FIXME: the storage should not be responsible for validation.
|
||||||
|
|
Loading…
Reference in a new issue