Skip to content
Snippets Groups Projects
Commit 3aa35463 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

fix(release): do not dump expired memberships if before current block

parent e546af19
No related branches found
No related tags found
1 merge request!199Release/runtime 700
Pipeline #34367 failed
...@@ -81,6 +81,13 @@ pub struct GenesisData<Parameters: DeserializeOwned, SessionKeys: Decode> { ...@@ -81,6 +81,13 @@ pub struct GenesisData<Parameters: DeserializeOwned, SessionKeys: Decode> {
pub ud: u64, pub ud: u64,
} }
#[derive(Deserialize, Serialize)]
struct BlockV1 {
number: u32,
#[serde(rename = "medianTime")]
median_time: u64,
}
#[derive(Clone)] #[derive(Clone)]
pub struct GenesisIdentity { pub struct GenesisIdentity {
pub idty_index: u32, pub idty_index: u32,
...@@ -139,6 +146,7 @@ struct TransactionV2 { ...@@ -139,6 +146,7 @@ struct TransactionV2 {
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
struct GenesisMigrationData { struct GenesisMigrationData {
initial_monetary_mass: u64, initial_monetary_mass: u64,
current_block: BlockV1,
identities: BTreeMap<String, IdentityV1>, identities: BTreeMap<String, IdentityV1>,
#[serde(default)] #[serde(default)]
wallets: BTreeMap<PubkeyV1, u64>, wallets: BTreeMap<PubkeyV1, u64>,
...@@ -1044,6 +1052,9 @@ fn check_genesis_data_and_filter_expired_certs_since_export( ...@@ -1044,6 +1052,9 @@ fn check_genesis_data_and_filter_expired_certs_since_export(
genesis_data.identities.iter_mut().for_each(|(name, i)| { genesis_data.identities.iter_mut().for_each(|(name, i)| {
if (i.membership_expire_on.0 as u64) < genesis_timestamp { if (i.membership_expire_on.0 as u64) < genesis_timestamp {
if (i.membership_expire_on.0 as u64) >= genesis_data.current_block.median_time {
log::warn!("{} membership expired since export", name);
}
i.membership_expire_on = TimestampV1(0); i.membership_expire_on = TimestampV1(0);
} }
}); });
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment