Cleanup Fullnode construction
leader_id was already set by Fullnode constructor. And cleanup the rest of that code while in the neighborhood. Thanks @CriesofCarrots!
This commit is contained in:
parent
4ab58f069a
commit
0c8eec2563
|
@ -76,19 +76,14 @@ fn main() -> () {
|
||||||
|
|
||||||
let ledger_path = matches.value_of("ledger").unwrap();
|
let ledger_path = matches.value_of("ledger").unwrap();
|
||||||
|
|
||||||
let mut node = TestNode::new_with_bind_addr(repl_data, bind_addr);
|
let node = TestNode::new_with_bind_addr(repl_data, bind_addr);
|
||||||
let mut drone_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), DRONE_PORT);
|
let mut drone_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), DRONE_PORT);
|
||||||
let fullnode = if let Some(t) = matches.value_of("testnet") {
|
let testnet_addr = matches.value_of("testnet").map(|addr_str| {
|
||||||
let testnet_address_string = t.to_string();
|
let addr: SocketAddr = addr_str.parse().unwrap();
|
||||||
let testnet_addr: SocketAddr = testnet_address_string.parse().unwrap();
|
drone_addr.set_ip(addr.ip());
|
||||||
drone_addr.set_ip(testnet_addr.ip());
|
addr
|
||||||
|
});
|
||||||
Fullnode::new(node, ledger_path, keypair, Some(testnet_addr), false)
|
let fullnode = Fullnode::new(node, ledger_path, keypair, testnet_addr, false);
|
||||||
} else {
|
|
||||||
node.data.leader_id = node.data.id;
|
|
||||||
|
|
||||||
Fullnode::new(node, ledger_path, keypair, None, false)
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut client = mk_client(&repl_clone);
|
let mut client = mk_client(&repl_clone);
|
||||||
let previous_balance = client.poll_get_balance(&leader_pubkey).unwrap_or(0);
|
let previous_balance = client.poll_get_balance(&leader_pubkey).unwrap_or(0);
|
||||||
|
|
Loading…
Reference in New Issue