Unverified Commit b6d664c5 authored by Roman Zeyde's avatar Roman Zeyde
Browse files

Let query module return errors

parent 4b0f3d47
......@@ -89,12 +89,8 @@ fn run_server(config: &Config) {
scope.spawn(|| rpc::serve(config.rpc_addr(), &query, chan));
loop {
thread::sleep(poll_delay);
query.update_mempool();
let current_tip = daemon
.getbestblockhash()
.expect("failed to get latest blockhash");
if tip == current_tip {
query.update_mempool().unwrap();
if tip == daemon.getbestblockhash().unwrap() {
continue;
}
tip = index.update(&store, &daemon);
......
......@@ -11,6 +11,8 @@ use mempool::Tracker;
use store::Store;
use types::HashPrefix;
error_chain!{}
pub struct FundingOutput {
pub txn_id: Sha256dHash,
pub height: i32,
......@@ -207,11 +209,11 @@ impl<'a> Query<'a> {
Some((merkle, pos))
}
pub fn update_mempool(&self) {
pub fn update_mempool(&self) -> Result<()> {
self.tracker
.write()
.unwrap()
.update(self.daemon)
.expect("failed to update mempool")
.chain_err(|| "failed to update mempool")
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment