Add unix_timestap to stake lockups (#7569)

This commit is contained in:
Rob Walker
2019-12-19 14:37:47 -08:00
committed by GitHub
parent 0245847ea8
commit 3f405d8908
12 changed files with 1038 additions and 373 deletions

View File

@@ -11,7 +11,6 @@ homepage = "https://solana.com/"
[dependencies]
base64 = "0.11.0"
clap = "2.33.0"
chrono = "0.4"
hex = "0.4.0"
serde = "1.0.104"
serde_derive = "1.0.103"

View File

@@ -1,8 +1,10 @@
//! A command-line executable for generating the chain's genesis config.
use chrono::DateTime;
use clap::{crate_description, crate_name, value_t, value_t_or_exit, App, Arg, ArgMatches};
use solana_clap_utils::{input_parsers::pubkey_of, input_validators::is_valid_percentage};
use solana_clap_utils::{
input_parsers::{pubkey_of, unix_timestamp_of},
input_validators::is_valid_percentage,
};
use solana_genesis::{genesis_accounts::add_genesis_accounts, Base64Account};
use solana_ledger::{blocktree::create_new_ledger, poh::compute_hashes_per_tick};
use solana_sdk::{
@@ -484,8 +486,8 @@ fn main() -> Result<(), Box<dyn error::Error>> {
..GenesisConfig::default()
};
if let Some(creation_time) = matches.value_of("creation_time") {
genesis_config.creation_time = DateTime::parse_from_rfc3339(creation_time)?.timestamp();
if let Some(creation_time) = unix_timestamp_of(&matches, "creation_time") {
genesis_config.creation_time = creation_time;
}
if let Some(faucet_pubkey) = faucet_pubkey {

View File

@@ -109,6 +109,7 @@ pub fn create_and_add_stakes(
let lockup = Lockup {
epoch: unlock.epoch,
custodian,
unix_timestamp: 0,
};
for _ in 0..(lamports / granularity).saturating_sub(1) {
genesis_config.add_account(