Update feature for creating checkpoints.

This commit is contained in:
Kevin Gorham 2020-02-21 18:24:28 -05:00
parent 4b1cb76f42
commit e431611d55
No known key found for this signature in database
GPG Key ID: CCA55602DF49FC38
4 changed files with 28 additions and 8 deletions

View File

@ -22,22 +22,25 @@ use service_grpc::CompactTxStreamer;
const LIGHTWALLETD_HOST: &str = "lightwalletd.z.cash";
const LIGHTWALLETD_PORT: u16 = 9067;
const BATCH_SIZE: u64 = 10_000;
const TARGET_HEIGHT: u64 = 735000;
const NETWORK: &str = "mainnet";
fn print_sapling_tree(height: u64, mut hash: Vec<u8>, time: u32, tree: CommitmentTree<Node>) {
hash.reverse();
let mut tree_bytes = vec![];
tree.write(&mut tree_bytes).unwrap();
println!("{{");
println!(" \"network\": \"{}\",", NETWORK);
println!(" \"height\": {},", height);
println!(" \"hash\": {},", hex::encode(hash));
println!(" \"hash\": \"{}\",", hex::encode(hash));
println!(" \"time\": {},", time);
println!(" \"tree\": \"{}\",", hex::encode(tree_bytes));
println!(" \"tree\": \"{}\"", hex::encode(tree_bytes));
println!("}}");
}
fn main() {
// For now, start from Sapling activation height
let mut start_height = 280000;
let mut start_height = 419200;
let mut tree = CommitmentTree::new();
let client_conf = Default::default();
@ -50,11 +53,7 @@ fn main() {
loop {
// Get the latest height
let latest_height = client
.get_latest_block(grpc::RequestOptions::new(), service::ChainSpec::new())
.wait_drop_metadata()
.unwrap()
.height;
let latest_height = TARGET_HEIGHT;
let end_height = if latest_height - start_height < BATCH_SIZE {
latest_height
} else {

View File

@ -0,0 +1,7 @@
{
"network": "mainnet",
"height": 720000,
"hash": "000000000225bab0e1491d6abfa4a41c174bc7d0167411e2cb2ebd960dae5158",
"time": 1581104786,
"tree": "0147c6af2c835328a4c17eff07f76102dc57716a13ce3d3a4f48367c3f2384fe2901e01e9b45be2ad8bedab63db1963c2b8d85e1ed20b6327cf2c55c211234e8a3351101134f80e61b548e384e87f823187d2734b07c516d48eea33a533c6cf7aa47052200000000000000017ce48111238d9e81b7e4147286578f2d686d71b1ec0cae668f567f3fef65bc0b017895f4c380f5169dcb84c7154fe6fcf72d694d30f0ba2535437b443a2cb5ae18000000013a1f7fb005388ac6f04099b647ed85d8b025d8ae4b178c2376b473b121b8c052000001d2ea556f49fb934dc76f087935a5c07788000b4e3aae24883adfec51b5f4d260"
}

View File

@ -0,0 +1,7 @@
{
"network": "mainnet",
"height": 730000,
"hash": "0000000002293b9e058e17fbc357c9b676d276eba338e033e357034c775ab320",
"time": 1581858634,
"tree": "019a59eba6efd060a61cde70daa7b34202e5fd55fcbf809eaf0aa3252e45810e48001101e106c6f8a17723af8793c1bd0f0e95dbcf5ef0bd80e20195422d8388db48cf24000001907e2c08367bfb45d196771ad267ec773c80ff4306aa7c4d2415ee22d211e90a00000001d72bda7061e4086bb885d6f26e39aa603a1f6db2e4fc71ae65a571c7a31ade27014df2a298ce5d7f8e88617b66ef7dc1fddd854e8dc623c3dc0faaa0eb93137d45017a48dab02dd9a014df0bd310657c3b8e854e24e1137f2ffcb1db693e38a4416d00011a5c078f7dd38704665b7270ebd90366fdd0edccdf284ca1f03c6d7e0536182800013a1f7fb005388ac6f04099b647ed85d8b025d8ae4b178c2376b473b121b8c052000001d2ea556f49fb934dc76f087935a5c07788000b4e3aae24883adfec51b5f4d260"
}

View File

@ -0,0 +1,7 @@
{
"network": "mainnet",
"height": 735000,
"hash": "00000000015c597fab53f58b9e1ededbe8bd83ca0203788e2039eceeb0d65ca6",
"time": 1582235356,
"tree": "0161f2ff97ff6ac6a90f9bce76c11710460f4944d8695aecc7dc99e34cad0131040011015325b185e23e82562db27817be996ffade9597181244f67efc40561aeb9dde1101daeffadc9e38f755bcb55a847a1278518a0ba4a2ef33b2fe01bbb3eb242ab0070000000000011c51f9077e3f7e28e8e337eaf4bb99b41acbc853a37dcc1e172467a1c919fe4100010bb1f55481b2268ef31997dc0fb6b48a530bc17870220f156d832326c433eb0a010b3768d3bf7868a67823e022f49be67982d0588e7041c498a756024750065a4a0001a9e1bf4bccb48b14b544e770f21d48f2d3ad8d6ca54eccc92f60634e3078eb48013a1f7fb005388ac6f04099b647ed85d8b025d8ae4b178c2376b473b121b8c052000001d2ea556f49fb934dc76f087935a5c07788000b4e3aae24883adfec51b5f4d260"
}