From b56ad5582daa2863e9052996091af20758f9e416 Mon Sep 17 00:00:00 2001 From: Peilun Li Date: Thu, 20 Jun 2024 17:39:03 +0800 Subject: [PATCH] Finalize the new tx at last. --- node/storage/src/log_store/log_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/storage/src/log_store/log_manager.rs b/node/storage/src/log_store/log_manager.rs index ba87cc2..484d0b9 100644 --- a/node/storage/src/log_store/log_manager.rs +++ b/node/storage/src/log_store/log_manager.rs @@ -323,7 +323,6 @@ impl LogStoreWrite for LogManager { // TODO: Should we double check the tx merkle root? let tx_end_index = tx.start_entry_index + bytes_to_entries(tx.size); if self.check_data_completed(tx.start_entry_index, tx_end_index)? { - self.tx_store.finalize_tx(tx_seq)?; let same_root_seq_list = self .tx_store .get_tx_seq_list_by_data_root(&tx.data_merkle_root)?; @@ -331,6 +330,7 @@ impl LogStoreWrite for LogManager { if same_root_seq_list.first() == Some(&tx_seq) { self.copy_tx_data(tx_seq, same_root_seq_list[1..].to_vec())?; } + self.tx_store.finalize_tx(tx_seq)?; Ok(true) } else { bail!("finalize tx hash with data missing: tx_seq={}", tx_seq)