mirror of
https://github.com/monero-project/monero.git
synced 2025-08-16 23:40:25 -04:00
blockchain sync: reduce disk writes from 2 to 1 per tx
This commit is contained in:
parent
d0118f4778
commit
008ba966da
29 changed files with 1186 additions and 1636 deletions
|
@ -257,6 +257,7 @@ namespace cryptonote
|
|||
CHECK_AND_ASSERT_MES(r, false, "Failed to parse transaction from blob");
|
||||
CHECK_AND_ASSERT_MES(expand_transaction_1(tx, false), false, "Failed to expand transaction data");
|
||||
tx.invalidate_hashes();
|
||||
tx.set_blob_size(tx_blob.size());
|
||||
//TODO: validate tx
|
||||
|
||||
return get_transaction_hash(tx, tx_hash);
|
||||
|
@ -520,6 +521,19 @@ namespace cryptonote
|
|||
return get_transaction_weight(tx, blob_size);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
uint64_t get_transaction_blob_size(const transaction& tx)
|
||||
{
|
||||
if (!tx.is_blob_size_valid())
|
||||
{
|
||||
const cryptonote::blobdata tx_blob = tx_to_blob(tx);
|
||||
tx.set_blob_size(tx_blob.size());
|
||||
}
|
||||
|
||||
CHECK_AND_ASSERT_THROW_MES(tx.is_blob_size_valid(), "BUG: blob size valid not set");
|
||||
|
||||
return tx.blob_size;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
bool get_tx_fee(const transaction& tx, uint64_t & fee)
|
||||
{
|
||||
if (tx.version > 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue