Skip to content

Commit 094c703

Browse files
committed
node: add namada_tx_hash field to CometBFT tx result
1 parent 399dbfc commit 094c703

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

crates/node/src/shell/finalize_block.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,12 @@ where
716716
let result_code = ResultCode::from_u32(processed_tx.result.code)
717717
.expect("Result code conversion should not fail");
718718

719+
let tx_hash = tx.header_hash();
720+
let result_info = serde_json::to_string(&serde_json::json!({
721+
"namada_tx_hash": tx_hash,
722+
}))
723+
.unwrap();
724+
719725
let tx_header = tx.header();
720726
// If [`process_proposal`] rejected a Tx, emit an event here and
721727
// move on to next tx
@@ -752,6 +758,7 @@ where
752758

753759
tx_results.push(tendermint::abci::types::ExecTxResult {
754760
code: result_code.into(),
761+
info: result_info,
755762
..Default::default()
756763
});
757764

@@ -783,6 +790,7 @@ where
783790
tx_results.push(
784791
tendermint::abci::types::ExecTxResult {
785792
code: result_code.into(),
793+
info: result_info,
786794
..Default::default()
787795
},
788796
);
@@ -877,7 +885,6 @@ where
877885
let tx_event = new_tx_event(&tx, height.0);
878886
let is_atomic_batch = tx.header.atomic;
879887
let commitments_len = tx.commitments().len() as u64;
880-
let tx_hash = tx.header_hash();
881888
let tx_gas_meter = RefCell::new(tx_gas_meter);
882889

883890
let dispatch_result = protocol::dispatch_tx(
@@ -902,6 +909,7 @@ where
902909
tx_results.push(tendermint::abci::types::ExecTxResult {
903910
code: result_code.into(),
904911
gas_used,
912+
info: result_info,
905913
..Default::default()
906914
});
907915

0 commit comments

Comments
 (0)