Skip to content

Commit 27a580b

Browse files
committed
feat(node): update global protocol version state when necessary
1 parent 28b630d commit 27a580b

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
@@ -19,6 +19,7 @@ use witnet_data_structures::{
1919
error::{ChainInfoError, TransactionError::DataRequestNotFound},
2020
get_protocol_version,
2121
proto::versioning::ProtocolVersion,
22+
refresh_protocol_version,
2223
staking::{errors::StakesError, prelude::StakeKey},
2324
transaction::{
2425
DRTransaction, StakeTransaction, Transaction, UnstakeTransaction, VTTransaction,
@@ -138,6 +139,11 @@ impl Handler<EpochNotification<EveryEpochPayload>> for ChainManager {
138139
protocol.current_version = get_protocol_version(self.current_epoch);
139140
}
140141

142+
// Update the global protocol version state if necessary
143+
if get_protocol_version(self.current_epoch) != get_protocol_version(None) {
144+
refresh_protocol_version(current_epoch);
145+
}
146+
141147
match self.sm_state {
142148
StateMachine::WaitingConsensus => {
143149
if let Some(chain_info) = &self.chain_state.chain_info {

0 commit comments

Comments
 (0)