Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Chiguireitor
addrindexrs
Commits
b6d664c5
Unverified
Commit
b6d664c5
authored
May 17, 2018
by
Roman Zeyde
Browse files
Let query module return errors
parent
4b0f3d47
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
src/bin/indexrs.rs
src/bin/indexrs.rs
+2
-6
src/query.rs
src/query.rs
+4
-2
No files found.
src/bin/indexrs.rs
View file @
b6d664c5
...
...
@@ -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
);
...
...
src/query.rs
View file @
b6d664c5
...
...
@@ -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"
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment