Skip to content

Commit eb51c96

Browse files
committed
node: add namada_tx_hash field to CometBFT tx result
1 parent 56f5878 commit eb51c96

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
@@ -732,6 +732,12 @@ where
732732
let result_code = ResultCode::from_u32(processed_tx.result.code)
733733
.expect("Result code conversion should not fail");
734734

735+
let tx_hash = tx.header_hash();
736+
let result_info = serde_json::to_string(&serde_json::json!({
737+
"namada_tx_hash": tx_hash,
738+
}))
739+
.unwrap();
740+
735741
let tx_header = tx.header();
736742
// If [`process_proposal`] rejected a Tx, emit an event here and
737743
// move on to next tx
@@ -768,6 +774,7 @@ where
768774

769775
tx_results.push(tendermint::abci::types::ExecTxResult {
770776
code: result_code.into(),
777+
info: result_info,
771778
..Default::default()
772779
});
773780

@@ -799,6 +806,7 @@ where
799806
tx_results.push(
800807
tendermint::abci::types::ExecTxResult {
801808
code: result_code.into(),
809+
info: result_info,
802810
..Default::default()
803811
},
804812
);
@@ -893,7 +901,6 @@ where
893901
let tx_event = new_tx_event(&tx, height.0);
894902
let is_atomic_batch = tx.header.atomic;
895903
let commitments_len = tx.commitments().len() as u64;
896-
let tx_hash = tx.header_hash();
897904
let tx_gas_meter = RefCell::new(tx_gas_meter);
898905

899906
let dispatch_result = protocol::dispatch_tx(
@@ -918,6 +925,7 @@ where
918925
tx_results.push(tendermint::abci::types::ExecTxResult {
919926
code: result_code.into(),
920927
gas_used,
928+
info: result_info,
921929
..Default::default()
922930
});
923931

0 commit comments

Comments
 (0)