get_confirmed_block: expect() less
This commit is contained in:
@ -1387,9 +1387,13 @@ impl Blockstore {
|
|||||||
let encoding = encoding.unwrap_or(RpcTransactionEncoding::Json);
|
let encoding = encoding.unwrap_or(RpcTransactionEncoding::Json);
|
||||||
if self.is_root(slot) {
|
if self.is_root(slot) {
|
||||||
let slot_meta_cf = self.db.column::<cf::SlotMeta>();
|
let slot_meta_cf = self.db.column::<cf::SlotMeta>();
|
||||||
let slot_meta = slot_meta_cf
|
let slot_meta = match slot_meta_cf.get(slot)? {
|
||||||
.get(slot)?
|
Some(slot_meta) => slot_meta,
|
||||||
.expect("Rooted slot must exist in SlotMeta");
|
None => {
|
||||||
|
info!("SlotMeta not found for rooted slot {}", slot);
|
||||||
|
return Err(BlockstoreError::SlotCleanedUp);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let slot_entries = self.get_slot_entries(slot, 0, None)?;
|
let slot_entries = self.get_slot_entries(slot, 0, None)?;
|
||||||
if !slot_entries.is_empty() {
|
if !slot_entries.is_empty() {
|
||||||
@ -1407,11 +1411,7 @@ impl Blockstore {
|
|||||||
let blockhash = get_last_hash(slot_entries.iter())
|
let blockhash = get_last_hash(slot_entries.iter())
|
||||||
.unwrap_or_else(|| panic!("Rooted slot {:?} must have blockhash", slot));
|
.unwrap_or_else(|| panic!("Rooted slot {:?} must have blockhash", slot));
|
||||||
|
|
||||||
let rewards = self
|
let rewards = self.rewards_cf.get(slot)?.unwrap_or_else(|| vec![]);
|
||||||
.rewards_cf
|
|
||||||
.get(slot)
|
|
||||||
.expect("Expect rewards get to succeed")
|
|
||||||
.unwrap_or_else(|| vec![]);
|
|
||||||
|
|
||||||
let block = RpcConfirmedBlock {
|
let block = RpcConfirmedBlock {
|
||||||
previous_blockhash: previous_blockhash.to_string(),
|
previous_blockhash: previous_blockhash.to_string(),
|
||||||
|
Reference in New Issue
Block a user