Implement Rpc in Fullnode

This commit is contained in:
Tyera Eulberg
2018-08-14 18:03:48 -06:00
committed by Tyera Eulberg
parent d3c09b4e96
commit c6662a4512
4 changed files with 231 additions and 221 deletions

View File

@ -7,6 +7,7 @@ use entry::Entry;
use ledger::read_ledger;
use ncp::Ncp;
use packet::BlobRecycler;
use rpc::{JsonRpcService, RPC_PORT};
use rpu::Rpu;
use service::Service;
use signature::{Keypair, KeypairUtil};
@ -190,7 +191,7 @@ impl Fullnode {
let tick_duration = None;
// TODO: To light up PoH, uncomment the following line:
//let tick_duration = Some(Duration::from_millis(1000));
// let node_info = node.data.clone();
let bank = Arc::new(bank);
let mut thread_hdls = vec![];
let rpu = Rpu::new(
@ -201,6 +202,11 @@ impl Fullnode {
);
thread_hdls.extend(rpu.thread_hdls());
let mut rpc_addr = node.data.contact_info.ncp;
rpc_addr.set_port(RPC_PORT);
let rpc_service = JsonRpcService::new(bank.clone(), rpc_addr);
thread_hdls.extend(rpc_service.thread_hdls());
let blob_recycler = BlobRecycler::default();
let window =
window::new_window_from_entries(ledger_tail, entry_height, &node.data, &blob_recycler);
@ -292,6 +298,11 @@ impl Fullnode {
);
thread_hdls.extend(rpu.thread_hdls());
let mut rpc_addr = node.data.contact_info.ncp;
rpc_addr.set_port(RPC_PORT);
let rpc_service = JsonRpcService::new(bank.clone(), rpc_addr);
thread_hdls.extend(rpc_service.thread_hdls());
let blob_recycler = BlobRecycler::default();
let window =
window::new_window_from_entries(ledger_tail, entry_height, &node.data, &blob_recycler);