mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Fix gen_gen bitcoin root setting (#2206)
* Move prev_root setting to after set_txhashset_roots so it doesn't get overwritten. * Remove git interactions, easier done manually. * rustfmt
This commit is contained in:
commit
75a39c504f
1 changed files with 9 additions and 26 deletions
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
use std::io::{BufRead, Write};
|
use std::io::{BufRead, Write};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::{fs, io, path, process};
|
use std::{fs, io, path};
|
||||||
|
|
||||||
use chrono::prelude::Utc;
|
use chrono::prelude::Utc;
|
||||||
use chrono::{Datelike, Duration, Timelike};
|
use chrono::{Datelike, Duration, Timelike};
|
||||||
|
@ -78,14 +78,13 @@ fn main() {
|
||||||
|
|
||||||
// build the basic parts of the genesis block header
|
// build the basic parts of the genesis block header
|
||||||
let mut gen = core::genesis::genesis_main();
|
let mut gen = core::genesis::genesis_main();
|
||||||
gen.header.timestamp = Utc::now() + Duration::minutes(30);
|
|
||||||
gen.header.prev_root = core::core::hash::Hash::from_hex(&h1).unwrap();
|
|
||||||
|
|
||||||
// build the wallet seed and derive a coinbase from local wallet.seed
|
// build the wallet seed and derive a coinbase from local wallet.seed
|
||||||
let seed = wallet::WalletSeed::from_file(
|
let seed = wallet::WalletSeed::from_file(
|
||||||
&wallet::WalletConfig::default(),
|
&wallet::WalletConfig::default(),
|
||||||
&rpassword::prompt_password_stdout("Password: ").unwrap()
|
&rpassword::prompt_password_stdout("Password: ").unwrap(),
|
||||||
).unwrap();
|
)
|
||||||
|
.unwrap();
|
||||||
let keychain: ExtKeychain = seed.derive_keychain().unwrap();
|
let keychain: ExtKeychain = seed.derive_keychain().unwrap();
|
||||||
let key_id = ExtKeychain::derive_key_id(2, 1, 0, 0, 0);
|
let key_id = ExtKeychain::derive_key_id(2, 1, 0, 0, 0);
|
||||||
let reward = core::libtx::reward::output(&keychain, &key_id, 0).unwrap();
|
let reward = core::libtx::reward::output(&keychain, &key_id, 0).unwrap();
|
||||||
|
@ -98,6 +97,11 @@ fn main() {
|
||||||
tmp_chain.set_txhashset_roots(&mut gen).unwrap();
|
tmp_chain.set_txhashset_roots(&mut gen).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sets the timestamp and prev_root from the bitcoin block (needs to be
|
||||||
|
// after set_txhashset roots to not get overwritten)
|
||||||
|
gen.header.timestamp = Utc::now() + Duration::minutes(30);
|
||||||
|
gen.header.prev_root = core::core::hash::Hash::from_hex(&h1).unwrap();
|
||||||
|
|
||||||
// mine a Cuckaroo29 block
|
// mine a Cuckaroo29 block
|
||||||
core::global::set_mining_mode(core::global::ChainTypes::Mainnet);
|
core::global::set_mining_mode(core::global::ChainTypes::Mainnet);
|
||||||
let plugin_lib = cuckoo::PluginLibrary::new(PLUGIN_PATH).unwrap();
|
let plugin_lib = cuckoo::PluginLibrary::new(PLUGIN_PATH).unwrap();
|
||||||
|
@ -150,26 +154,6 @@ fn main() {
|
||||||
update_genesis_rs(&gen);
|
update_genesis_rs(&gen);
|
||||||
println!("genesis.rs has been updated, check it and run mainnet_genesis_hash test");
|
println!("genesis.rs has been updated, check it and run mainnet_genesis_hash test");
|
||||||
println!("also check bitcoin block {} hasn't been orphaned.", h1);
|
println!("also check bitcoin block {} hasn't been orphaned.", h1);
|
||||||
println!("press c+enter to proceed.");
|
|
||||||
let mut input = String::new();
|
|
||||||
io::stdin().read_line(&mut input).unwrap();
|
|
||||||
if input != "c\n" {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Commit genesis block info in git and tag
|
|
||||||
process::Command::new("git")
|
|
||||||
.args(&["commit", "-am", "Minor: finalized genesis block"])
|
|
||||||
.status()
|
|
||||||
.expect("git commit failed");
|
|
||||||
process::Command::new("git")
|
|
||||||
.args(&["tag", "-a", "v1.0", "-m", "Mainnet release"])
|
|
||||||
.status()
|
|
||||||
.expect("git tag failed");
|
|
||||||
process::Command::new("git")
|
|
||||||
.args(&["push", "origin", "v1.0"])
|
|
||||||
.status()
|
|
||||||
.expect("git tag push failed");
|
|
||||||
println!("All done!");
|
println!("All done!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,4 +320,3 @@ fn get_json(url: &str) -> serde_json::Value {
|
||||||
}
|
}
|
||||||
serde_json::from_slice(&body).unwrap()
|
serde_json::from_slice(&body).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue