Skip to content

Commit

Permalink
fix(platform): core info is lost between genesis and first block (#2004)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer authored Jul 25, 2024
1 parent 2025440 commit 45825c1
Showing 1 changed file with 25 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,33 @@ where
core_block_height,
block_platform_state.last_committed_core_height()
);
//todo: there's a weird condition that can happen if we are not on init chain, but we are
// in the genesis and we are not on round 0, and the core height changed
if block_platform_state.last_committed_block_info().is_some() || is_init_chain {
let update_state_masternode_list_outcome::v0::UpdateStateMasternodeListOutcome {
masternode_list_diff,
removed_masternodes,
} = self.update_state_masternode_list_v0(
block_platform_state,
core_block_height,
is_init_chain,
)?;

self.update_masternode_identities(
masternode_list_diff,
&removed_masternodes,
block_info,
platform_state,
transaction,
platform_version,
)?;
let update_state_masternode_list_outcome::v0::UpdateStateMasternodeListOutcome {
masternode_list_diff,
removed_masternodes,
} = self.update_state_masternode_list_v0(
block_platform_state,
core_block_height,
is_init_chain,
)?;

if !removed_masternodes.is_empty() {
self.drive.remove_validators_proposed_app_versions(
removed_masternodes
.into_keys()
.map(|pro_tx_hash| pro_tx_hash.into()),
Some(transaction),
&platform_version.drive,
)?;
}
self.update_masternode_identities(
masternode_list_diff,
&removed_masternodes,
block_info,
platform_state,
transaction,
platform_version,
)?;

if !removed_masternodes.is_empty() {
self.drive.remove_validators_proposed_app_versions(
removed_masternodes
.into_keys()
.map(|pro_tx_hash| pro_tx_hash.into()),
Some(transaction),
&platform_version.drive,
)?;
}

Ok(())
Expand Down

0 comments on commit 45825c1

Please sign in to comment.