Add dump tx when revert block and cancel challenge.
+use crate::debugger::dump_transaction;
use crate::poa::{PoA, ShouldIssueBlock};
use crate::rpc_client::RPCClient;
use crate::test_mode_control::TestModeControl;
@@ -272,16 +273,32 @@ impl Challenger {
let verifier_dep = cancel_output.verifier_dep(&self.config)?.to_owned();
let verifier_input = cancel_output.verifier_input(verifier_tx_hash, 0);
let verifier_witness = cancel_output.verifier_witness.clone();
- let tx = self.build_cancel_tx(
+ let tx = self
+ .build_cancel_tx(
rollup_state,
cancel_output,
challenge_input,
verifier_dep.clone(),
verifier_input.clone(),
media_time,
+ )
+ .await?;
+
+ if let Err(err) = dump_transaction(
+ &self.config.debug_tx_dump_path,
+ &self.rpc_client,
+ tx.clone(),
+ )
+ .await
+ {
+ log::error!(
+ "Faild to dump transaction {} error: {}",
+ hex::encode(&tx.hash()),
+ err
);
+ }
- match self.rpc_client.send_transaction(tx.await?).await {
+ match self.rpc_client.send_transaction(tx).await {
Ok(tx_hash) => log::info!("Cancel challenge in tx {}", to_hex(&tx_hash)),
Err(err) => {
log::error!("Cancel challenge failed: {}", err);
@@ -409,6 +426,19 @@ impl Challenger {
fill_tx_fee(&mut tx_skeleton, &self.rpc_client, challenger_lock).await?;
let tx = self.wallet.sign_tx_skeleton(tx_skeleton)?;
+ if let Err(err) = dump_transaction(
+ &self.config.debug_tx_dump_path,
+ &self.rpc_client,
+ tx.clone(),
+ )
+ .await
+ {
+ log::error!(
+ "Faild to dump transaction {} error: {}",
+ hex::encode(&tx.hash()),
+ err
+ );
+ }
let tx_hash = self.rpc_client.send_transaction(tx).await?;
log::info!("Revert block in tx {}", to_hex(&tx_hash));
