Skip to content

Commit

Permalink
chore: do not retry for TransactionFailedToResolve
Browse files Browse the repository at this point in the history
  • Loading branch information
keroro520 committed Aug 5, 2021
1 parent 272737a commit 34dc1a1
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions ckb-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod watcher;
mod tests;

use crate::bench::{LiveCellProducer, TransactionProducer};
use crate::prepare::{collect, dispatch, derive_privkeys};
use crate::prepare::{collect, derive_privkeys, dispatch};
use crate::utils::maybe_retry_send_transaction;
use crate::watcher::Watcher;
use ckb_crypto::secp::Privkey;
Expand Down Expand Up @@ -317,19 +317,15 @@ pub fn entrypoint(clap_arg_match: ArgMatches<'static>) {
sleep(t_tx_interval);
}

loop {
i = (i + 1) % nodes.len();
match maybe_retry_send_transaction(&nodes[i], &tx) {
Ok(_hash) => {
benched_transactions += 1;
break;
}
Err(err) => {
ckb_testkit::error!(
"failed to send tx {:#x}, error: {}",
tx.hash(),
err
);
i = (i + 1) % nodes.len();
match maybe_retry_send_transaction(&nodes[i], &tx) {
Ok(_hash) => {
benched_transactions += 1;
}
Err(err) => {
// double spending, discard this transaction
if !err.contains("TransactionFailedToResolve") {
ckb_testkit::error!("failed to send tx {:#x}, error: {}", tx.hash(), err);
}
}
}
Expand Down

0 comments on commit 34dc1a1

Please sign in to comment.