Skip to content

Commit 45825c1

Browse files
fix(platform): core info is lost between genesis and first block (#2004)
1 parent 2025440 commit 45825c1

File tree

1 file changed

+25
-28
lines changed
  • packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0

1 file changed

+25
-28
lines changed

packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,36 +58,33 @@ where
5858
core_block_height,
5959
block_platform_state.last_committed_core_height()
6060
);
61-
//todo: there's a weird condition that can happen if we are not on init chain, but we are
62-
// in the genesis and we are not on round 0, and the core height changed
63-
if block_platform_state.last_committed_block_info().is_some() || is_init_chain {
64-
let update_state_masternode_list_outcome::v0::UpdateStateMasternodeListOutcome {
65-
masternode_list_diff,
66-
removed_masternodes,
67-
} = self.update_state_masternode_list_v0(
68-
block_platform_state,
69-
core_block_height,
70-
is_init_chain,
71-
)?;
7261

73-
self.update_masternode_identities(
74-
masternode_list_diff,
75-
&removed_masternodes,
76-
block_info,
77-
platform_state,
78-
transaction,
79-
platform_version,
80-
)?;
62+
let update_state_masternode_list_outcome::v0::UpdateStateMasternodeListOutcome {
63+
masternode_list_diff,
64+
removed_masternodes,
65+
} = self.update_state_masternode_list_v0(
66+
block_platform_state,
67+
core_block_height,
68+
is_init_chain,
69+
)?;
8170

82-
if !removed_masternodes.is_empty() {
83-
self.drive.remove_validators_proposed_app_versions(
84-
removed_masternodes
85-
.into_keys()
86-
.map(|pro_tx_hash| pro_tx_hash.into()),
87-
Some(transaction),
88-
&platform_version.drive,
89-
)?;
90-
}
71+
self.update_masternode_identities(
72+
masternode_list_diff,
73+
&removed_masternodes,
74+
block_info,
75+
platform_state,
76+
transaction,
77+
platform_version,
78+
)?;
79+
80+
if !removed_masternodes.is_empty() {
81+
self.drive.remove_validators_proposed_app_versions(
82+
removed_masternodes
83+
.into_keys()
84+
.map(|pro_tx_hash| pro_tx_hash.into()),
85+
Some(transaction),
86+
&platform_version.drive,
87+
)?;
9188
}
9289

9390
Ok(())

0 commit comments

Comments
 (0)