Add storage mining pool to genesis and implement automatic reward redeeming (#4683)
* Add storage mining pool to genesis and implement automatic reward collection * Address review comments
This commit is contained in:
@ -2,11 +2,20 @@ use clap::{crate_description, crate_name, crate_version, App, Arg};
|
||||
use solana::cluster_info::{Node, FULLNODE_PORT_RANGE};
|
||||
use solana::contact_info::ContactInfo;
|
||||
use solana::replicator::Replicator;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil};
|
||||
use std::net::SocketAddr;
|
||||
use std::process::exit;
|
||||
use std::sync::Arc;
|
||||
|
||||
// Return an error if a pubkey cannot be parsed.
|
||||
fn is_pubkey(string: String) -> Result<(), String> {
|
||||
match string.parse::<Pubkey>() {
|
||||
Ok(_) => Ok(()),
|
||||
Err(err) => Err(format!("{:?}", err)),
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
solana_logger::setup();
|
||||
|
||||
@ -21,6 +30,14 @@ fn main() {
|
||||
.takes_value(true)
|
||||
.help("File containing an identity (keypair)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("storage_mining_pool_pubkey")
|
||||
.long("mining-pool")
|
||||
.value_name("PUBKEY_BASE58_STR")
|
||||
.takes_value(true)
|
||||
.validator(is_pubkey)
|
||||
.help("The public key of the storage mining pool"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("entrypoint")
|
||||
.short("n")
|
||||
@ -69,6 +86,10 @@ fn main() {
|
||||
Keypair::new()
|
||||
};
|
||||
|
||||
let storage_mining_pool_pubkey = matches
|
||||
.value_of("storage_mining_pool_pubkey")
|
||||
.map(|value| value.parse::<Pubkey>().unwrap());
|
||||
|
||||
let entrypoint_addr = matches
|
||||
.value_of("entrypoint")
|
||||
.map(|entrypoint| {
|
||||
@ -101,6 +122,6 @@ fn main() {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
replicator.run();
|
||||
replicator.run(storage_mining_pool_pubkey);
|
||||
replicator.close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user