Skip to content

Commit

Permalink
fix(bootstrap): fix num_accounts query retry logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tizoc committed Mar 21, 2024
1 parent 370b4a5 commit 76cdf13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Expand Up @@ -160,9 +160,9 @@ impl redux::EnablingCondition<crate::State> for TransitionFrontierSyncLedgerSnar
// True if the next queued query is NumAccounts
let check_num_accounts = match ledger {
TransitionFrontierSyncLedgerSnarkedState::Pending {
pending_num_accounts,
pending_num_accounts: None,
..
} => ledger.is_num_accounts_query_next() && pending_num_accounts.is_none(),
} => ledger.is_num_accounts_query_next(),
_ => false,
};

Expand All @@ -188,7 +188,6 @@ impl redux::EnablingCondition<crate::State> for TransitionFrontierSyncLedgerSnar
.map(|peer_rpc_state| matches!(peer_rpc_state, PeerRpcState::Init { .. }))
.unwrap_or(false)
}),
// TODO(sync): do we need Retry for this one?
TransitionFrontierSyncLedgerSnarkedAction::PeerQueryNumAccountsRetry { peer_id } => {
None.or_else(|| {
let target_best_tip = state.transition_frontier.sync.best_tip()?;
Expand All @@ -198,9 +197,9 @@ impl redux::EnablingCondition<crate::State> for TransitionFrontierSyncLedgerSnar
// True if the next queued query is NumAccounts
let check_num_accounts = match ledger {
TransitionFrontierSyncLedgerSnarkedState::Pending {
pending_num_accounts,
pending_num_accounts: Some(_),
..
} => ledger.is_num_accounts_query_next() && pending_num_accounts.is_none(),
} => ledger.is_num_accounts_query_next(),
_ => false,
};

Expand Down
Expand Up @@ -108,6 +108,10 @@ impl TransitionFrontierSyncLedgerSnarkedAction {
TransitionFrontierSyncLedgerSnarkedAction::PeerQueryNumAccountsInit {
peer_id: *peer_id,
},
) || store.dispatch(
TransitionFrontierSyncLedgerSnarkedAction::PeerQueryNumAccountsRetry {
peer_id: *peer_id,
},
) {
return;
}
Expand Down

0 comments on commit 76cdf13

Please sign in to comment.