Support getBlockTime for unfinalized blocks (#16103)
This commit is contained in:
@ -875,10 +875,15 @@ impl JsonRpcRequestProcessor {
|
|||||||
}
|
}
|
||||||
self.check_slot_cleaned_up(&result, slot)?;
|
self.check_slot_cleaned_up(&result, slot)?;
|
||||||
Ok(result.ok().unwrap_or(None))
|
Ok(result.ok().unwrap_or(None))
|
||||||
|
} else {
|
||||||
|
let r_bank_forks = self.bank_forks.read().unwrap();
|
||||||
|
if let Some(bank) = r_bank_forks.get(slot) {
|
||||||
|
Ok(Some(bank.clock().unix_timestamp))
|
||||||
} else {
|
} else {
|
||||||
Err(RpcCustomError::BlockNotAvailable { slot }.into())
|
Err(RpcCustomError::BlockNotAvailable { slot }.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_signature_confirmation_status(
|
pub fn get_signature_confirmation_status(
|
||||||
&self,
|
&self,
|
||||||
|
@ -377,7 +377,7 @@ Result:
|
|||||||
|
|
||||||
### getBlockTime
|
### getBlockTime
|
||||||
|
|
||||||
Returns the estimated production time of a confirmed block.
|
Returns the estimated production time of a block.
|
||||||
|
|
||||||
Each validator reports their UTC time to the ledger on a regular interval by
|
Each validator reports their UTC time to the ledger on a regular interval by
|
||||||
intermittently adding a timestamp to a Vote for a particular block. A requested
|
intermittently adding a timestamp to a Vote for a particular block. A requested
|
||||||
|
Reference in New Issue
Block a user