Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Return root when bank not found #11188

Merged
merged 2 commits into from
Jul 24, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion core/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,24 @@ impl JsonRpcRequestProcessor {
}
};

r_bank_forks.get(slot).cloned().unwrap()
r_bank_forks.get(slot).cloned().unwrap_or_else(|| {
// We log an error instead of returning an error, because all known error cases
// are due to known bugs that should be fixed instead.
//
// The slot may not be found a result of a known bug in snapshot creation, where
garious marked this conversation as resolved.
Show resolved Hide resolved
// the bank at the given slot was not included in the snapshot.
// Also, it may occur after an old bank has been purged from BankForks and a new
// BlockCommitmentCache has not yet arrived. To make this case impossible,
// BlockCommitmentCache should hold an `Arc<Bank>` everywhere it currently holds
// a slot.
//
// For more information, see https://github.com/solana-labs/solana/issues/11078
error!(
"Bank with {:?} not found at slot: {:?}",
commitment_level, slot
);
r_bank_forks.root_bank().clone()
})
}

pub fn new(
Expand Down