Update tendermint/node to latest substrate

This commit is contained in:
Luke Parker
2023-03-06 08:20:01 -05:00
parent 4a81640ab8
commit db1fefe7c1
3 changed files with 7 additions and 8 deletions

View File

@@ -202,7 +202,7 @@ pub async fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceE
spawn_handle: task_manager.spawn_handle(), spawn_handle: task_manager.spawn_handle(),
import_queue, import_queue,
block_announce_validator_builder: None, block_announce_validator_builder: None,
warp_sync: None, warp_sync_params: None,
})?; })?;
if config.offchain_worker.enabled { if config.offchain_worker.enabled {

View File

@@ -14,7 +14,7 @@ use sp_runtime::{
}; };
use sp_inherents::{InherentData, InherentDataProvider, CreateInherentDataProviders}; use sp_inherents::{InherentData, InherentDataProvider, CreateInherentDataProviders};
use sp_blockchain::HeaderBackend; use sp_blockchain::HeaderBackend;
use sp_api::{BlockId, ProvideRuntimeApi}; use sp_api::ProvideRuntimeApi;
use sp_consensus::Error; use sp_consensus::Error;
use sc_consensus::{ForkChoiceStrategy, BlockImportParams}; use sc_consensus::{ForkChoiceStrategy, BlockImportParams};
@@ -121,7 +121,7 @@ impl<T: TendermintValidator> TendermintImport<T> {
let err = self let err = self
.client .client
.runtime_api() .runtime_api()
.check_inherents(&BlockId::Hash(self.client.info().finalized_hash), block, inherent_data) .check_inherents(self.client.info().finalized_hash, block, inherent_data)
.map_err(|_| Error::Other(BlockError::Fatal.into()))?; .map_err(|_| Error::Other(BlockError::Fatal.into()))?;
if err.ok() { if err.ok() {

View File

@@ -11,7 +11,7 @@ use sp_application_crypto::{
use sp_keystore::CryptoStore; use sp_keystore::CryptoStore;
use sp_staking::SessionIndex; use sp_staking::SessionIndex;
use sp_api::{BlockId, ProvideRuntimeApi}; use sp_api::ProvideRuntimeApi;
use sc_client_api::HeaderBackend; use sc_client_api::HeaderBackend;
@@ -34,8 +34,8 @@ impl TendermintValidatorsStruct {
fn from_module<T: TendermintClient>(client: &Arc<T::Client>) -> Self { fn from_module<T: TendermintClient>(client: &Arc<T::Client>) -> Self {
let last = client.info().finalized_hash; let last = client.info().finalized_hash;
let api = client.runtime_api(); let api = client.runtime_api();
let session = api.current_session(&BlockId::Hash(last)).unwrap(); let session = api.current_session(last).unwrap();
let validators = api.validators(&BlockId::Hash(last)).unwrap(); let validators = api.validators(last).unwrap();
Self { Self {
session, session,
@@ -59,8 +59,7 @@ impl<T: TendermintClient> Refresh<T> {
// If the session has changed, re-create the struct with the data on it // If the session has changed, re-create the struct with the data on it
fn refresh(&self) { fn refresh(&self) {
let session = self._refresh.read().unwrap().session; let session = self._refresh.read().unwrap().session;
let current_block = BlockId::Hash(self.client.info().finalized_hash); if session != self.client.runtime_api().current_session(self.client.info().finalized_hash).unwrap() {
if session != self.client.runtime_api().current_session(&current_block).unwrap() {
*self._refresh.write().unwrap() = TendermintValidatorsStruct::from_module::<T>(&self.client); *self._refresh.write().unwrap() = TendermintValidatorsStruct::from_module::<T>(&self.client);
} }
} }