diff --git a/cmd/starcoin/src/cli_state.rs b/cmd/starcoin/src/cli_state.rs index 085d126a74..0c79250b3a 100644 --- a/cmd/starcoin/src/cli_state.rs +++ b/cmd/starcoin/src/cli_state.rs @@ -167,7 +167,14 @@ impl CliState { } pub fn watch_txn(&self, txn_hash: HashValue) -> Result { - let block = self.client.watch_txn(txn_hash, Some(self.watch_timeout))?; + let block = self + .client + .watch_txn(txn_hash, Some(self.watch_timeout)) + .map(Some) + .unwrap_or_else(|e| { + println!("Watch txn {:?} err: {:?}", txn_hash, e); + None + }); let txn_info = { if let Some(info) = self.client.chain_get_transaction_info(txn_hash)? { @@ -178,7 +185,7 @@ impl CliState { if let Some(info) = self.client.chain_get_transaction_info(txn_hash)? { info } else { - bail!("transaction execute success, but get transaction info return none, block: {}", block.header.number); + bail!("transaction execute success, but get transaction info return none, block: {}", block.map(|b|b.header.number.to_string()).unwrap_or("unknown".to_string())); } } };