mirror of
https://github.com/serai-dex/serai.git
synced 2025-02-03 11:46:31 +00:00
Replace best_* with finalized_*
We test their equivalency yet still better to use finalized_* in general.
This commit is contained in:
parent
c0056643c8
commit
503adfee2f
3 changed files with 6 additions and 6 deletions
|
@ -72,10 +72,10 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
|
|||
let info = self.import.client.info();
|
||||
|
||||
(
|
||||
info.best_hash,
|
||||
info.finalized_hash,
|
||||
(
|
||||
// Header::Number: TryInto<u64> doesn't implement Debug and can't be unwrapped
|
||||
match info.best_number.try_into() {
|
||||
match info.finalized_number.try_into() {
|
||||
Ok(best) => BlockNumber(best),
|
||||
Err(_) => panic!("BlockNumber exceeded u64"),
|
||||
},
|
||||
|
@ -85,7 +85,7 @@ impl<T: TendermintValidator> TendermintAuthority<T> {
|
|||
&mut self
|
||||
.import
|
||||
.client
|
||||
.justifications(&BlockId::Hash(info.best_hash))
|
||||
.justifications(&BlockId::Hash(info.finalized_hash))
|
||||
.unwrap()
|
||||
.map(|justifications| justifications.get(CONSENSUS_ID).cloned().unwrap())
|
||||
.unwrap_or_default()
|
||||
|
|
|
@ -78,7 +78,7 @@ impl<T: TendermintValidator> TendermintImport<T> {
|
|||
number: <<T::Block as Block>::Header as Header>::Number,
|
||||
) -> Result<(), Error> {
|
||||
let info = self.client.info();
|
||||
if (info.best_hash != parent) || ((info.best_number + 1u16.into()) != number) {
|
||||
if (info.finalized_hash != parent) || ((info.finalized_number + 1u16.into()) != number) {
|
||||
Err(Error::Other("non-sequential import".into()))?;
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -29,7 +29,7 @@ struct TendermintValidatorsStruct {
|
|||
|
||||
impl TendermintValidatorsStruct {
|
||||
fn from_module<T: TendermintClient>(client: &Arc<T::Client>) -> TendermintValidatorsStruct {
|
||||
let last = client.info().best_hash;
|
||||
let last = client.info().finalized_hash;
|
||||
let api = client.runtime_api();
|
||||
let session = api.current_session(&BlockId::Hash(last)).unwrap();
|
||||
let validators = api.validators(&BlockId::Hash(last)).unwrap();
|
||||
|
@ -63,7 +63,7 @@ impl<T: TendermintClient> Refresh<T> {
|
|||
self
|
||||
.client
|
||||
.runtime_api()
|
||||
.current_session(&BlockId::Hash(self.client.info().best_hash))
|
||||
.current_session(&BlockId::Hash(self.client.info().finalized_hash))
|
||||
.unwrap()
|
||||
{
|
||||
*self._refresh.write().unwrap() = TendermintValidatorsStruct::from_module::<T>(&self.client);
|
||||
|
|
Loading…
Reference in a new issue