Skip to content

Commit 28b630d

Browse files
committed
feat(node): make sure that protocol info is synced in chain state
1 parent cb6f067 commit 28b630d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

node/src/actors/chain_manager/handlers.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use witnet_data_structures::{
1717
Hash, Hashable, NodeStats, PublicKeyHash, SuperBlockVote, SupplyInfo, ValueTransferOutput,
1818
},
1919
error::{ChainInfoError, TransactionError::DataRequestNotFound},
20+
get_protocol_version,
2021
proto::versioning::ProtocolVersion,
2122
staking::{errors::StakesError, prelude::StakeKey},
2223
transaction::{
@@ -132,6 +133,11 @@ impl Handler<EpochNotification<EveryEpochPayload>> for ChainManager {
132133
// The best candidate must be cleared on every epoch
133134
let best_candidate = self.best_candidate.take();
134135

136+
// Make sure that the protocol info in the chain state is kept up to date
137+
if let Some(ChainInfo { protocol, .. }) = &mut self.chain_state.chain_info {
138+
protocol.current_version = get_protocol_version(self.current_epoch);
139+
}
140+
135141
match self.sm_state {
136142
StateMachine::WaitingConsensus => {
137143
if let Some(chain_info) = &self.chain_state.chain_info {

0 commit comments

Comments
 (0)