debugging rpc...

This commit is contained in:
debris 2016-01-25 17:45:26 +01:00
parent fede7ca35c
commit f38b736c91
5 changed files with 9 additions and 4 deletions

View File

@ -83,6 +83,7 @@ impl EthFilter for EthFilterClient {
} }
fn filter_changes(&self, _: Params) -> Result<Value, Error> { fn filter_changes(&self, _: Params) -> Result<Value, Error> {
Ok(Value::String(self.client.chain_info().best_block_hash.to_hex())) println!("filter changes: {:?}", self.client.chain_info().best_block_hash.to_hex());
Ok(Value::Array(vec![Value::String(self.client.chain_info().best_block_hash.to_hex())]))
} }
} }

View File

@ -9,6 +9,10 @@ impl NetClient {
} }
impl Net for NetClient { impl Net for NetClient {
fn version(&self, _: Params) -> Result<Value, Error> {
Ok(Value::U64(63))
}
fn peer_count(&self, _params: Params) -> Result<Value, Error> { fn peer_count(&self, _params: Params) -> Result<Value, Error> {
Ok(Value::U64(0)) Ok(Value::U64(0))
} }

View File

@ -59,7 +59,7 @@ pub trait EthFilter: Sized + Send + Sync + 'static {
let mut delegate = IoDelegate::new(Arc::new(self)); let mut delegate = IoDelegate::new(Arc::new(self));
delegate.add_method("eth_newBlockFilter", EthFilter::new_block_filter); delegate.add_method("eth_newBlockFilter", EthFilter::new_block_filter);
delegate.add_method("eth_newPendingTransactionFilter", EthFilter::new_pending_transaction_filter); delegate.add_method("eth_newPendingTransactionFilter", EthFilter::new_pending_transaction_filter);
delegate.add_method("eth_getFilterChanges", EthFilter::new_block_filter); delegate.add_method("eth_getFilterChanges", EthFilter::filter_changes);
delegate delegate
} }
} }

View File

@ -13,8 +13,8 @@ pub trait Net: Sized + Send + Sync + 'static {
/// Should be used to convert object to io delegate. /// Should be used to convert object to io delegate.
fn to_delegate(self) -> IoDelegate<Self> { fn to_delegate(self) -> IoDelegate<Self> {
let mut delegate = IoDelegate::new(Arc::new(self)); let mut delegate = IoDelegate::new(Arc::new(self));
delegate.add_method("peer_count", Net::version);
delegate.add_method("net_version", Net::version); delegate.add_method("net_version", Net::version);
delegate.add_method("net_peerCount", Net::peer_count);
delegate delegate
} }
} }

View File

@ -269,7 +269,7 @@ impl Client {
/// Tick the client. /// Tick the client.
pub fn tick(&self) { pub fn tick(&self) {
self.chain.read().unwrap().collect_garbage(false); //self.chain.read().unwrap().collect_garbage(false);
} }
} }