mirror of
https://github.com/monero-project/monero.git
synced 2026-01-10 04:05:24 -08:00
db_lmdb: save pruned and prunable tx data separately
This bumps DB version to 2, migration code will run for v1 DBs
This commit is contained in:
@@ -121,10 +121,10 @@ void BlockchainDB::pop_block()
|
||||
pop_block(blk, txs);
|
||||
}
|
||||
|
||||
void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash* tx_hash_ptr)
|
||||
void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash* tx_hash_ptr, const crypto::hash* tx_prunable_hash_ptr)
|
||||
{
|
||||
bool miner_tx = false;
|
||||
crypto::hash tx_hash;
|
||||
crypto::hash tx_hash, tx_prunable_hash;
|
||||
if (!tx_hash_ptr)
|
||||
{
|
||||
// should only need to compute hash for miner transactions
|
||||
@@ -135,6 +135,13 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const transacti
|
||||
{
|
||||
tx_hash = *tx_hash_ptr;
|
||||
}
|
||||
if (tx.version >= 2)
|
||||
{
|
||||
if (!tx_prunable_hash_ptr)
|
||||
tx_prunable_hash = get_transaction_prunable_hash(tx);
|
||||
else
|
||||
tx_prunable_hash = *tx_prunable_hash_ptr;
|
||||
}
|
||||
|
||||
for (const txin_v& tx_input : tx.vin)
|
||||
{
|
||||
@@ -161,7 +168,7 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const transacti
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t tx_id = add_transaction_data(blk_hash, tx, tx_hash);
|
||||
uint64_t tx_id = add_transaction_data(blk_hash, tx, tx_hash, tx_prunable_hash);
|
||||
|
||||
std::vector<uint64_t> amount_output_indices;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user