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
0dae2f19
Unverified
Commit
0dae2f19
authored
Dec 07, 2018
by
Roman Zeyde
Browse files
Re-format latest Rust version
parent
e49cef1b
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
103 additions
and
90 deletions
+103
-90
Cargo.lock
Cargo.lock
+71
-71
src/bin/electrs.rs
src/bin/electrs.rs
+2
-1
src/bulk.rs
src/bulk.rs
+2
-1
src/daemon.rs
src/daemon.rs
+6
-3
src/errors.rs
src/errors.rs
+1
-1
src/index.rs
src/index.rs
+6
-3
src/mempool.rs
src/mempool.rs
+2
-1
src/rpc.rs
src/rpc.rs
+11
-8
src/util.rs
src/util.rs
+2
-1
No files found.
Cargo.lock
View file @
0dae2f19
This diff is collapsed.
Click to expand it.
src/bin/electrs.rs
View file @
0dae2f19
...
...
@@ -51,7 +51,8 @@ fn run_server(config: &Config) -> Result<()> {
index
.reload
(
&
store
);
// make sure the block header index is up-to-date
store
}
}
.enable_compaction
();
// enable auto compactions before starting incremental index updates.
}
.enable_compaction
();
// enable auto compactions before starting incremental index updates.
let
app
=
App
::
new
(
store
,
index
,
daemon
)
?
;
let
tx_cache
=
TransactionCache
::
new
(
config
.tx_cache_size
);
...
...
src/bulk.rs
View file @
0dae2f19
...
...
@@ -241,6 +241,7 @@ pub fn index_blk_files(
});
store
.write
(
vec!
[
parser
.last_indexed_row
()]);
store
})
.join
()
})
.join
()
.expect
(
"writer panicked"
))
}
src/daemon.rs
View file @
0dae2f19
...
...
@@ -26,7 +26,8 @@ fn parse_hash(value: &Value) -> Result<Sha256dHash> {
value
.as_str
()
.chain_err
(||
format!
(
"non-string value: {}"
,
value
))
?
,
)
.chain_err
(||
format!
(
"non-hex value: {}"
,
value
))
?
)
)
.chain_err
(||
format!
(
"non-hex value: {}"
,
value
))
?
)
}
fn
header_from_value
(
value
:
Value
)
->
Result
<
BlockHeader
>
{
...
...
@@ -206,7 +207,8 @@ impl Connection {
.next
()
.chain_err
(||
{
ErrorKind
::
Connection
(
"disconnected from daemon while receiving"
.to_owned
())
})
?
.chain_err
(||
"failed to read status"
)
?
;
})
?
.chain_err
(||
"failed to read status"
)
?
;
let
mut
headers
=
HashMap
::
new
();
for
line
in
iter
{
let
line
=
line
.chain_err
(||
ErrorKind
::
Connection
(
"failed to read"
.to_owned
()))
?
;
...
...
@@ -478,7 +480,8 @@ impl Daemon {
self
.request
(
"getblock"
,
json!
([
blockhash
.be_hex_string
(),
/*verbose=*/
1
]),
)
?
.get
(
"tx"
)
)
?
.get
(
"tx"
)
.chain_err
(||
"block missing txids"
)
?
.as_array
()
.chain_err
(||
"invalid block txids"
)
?
...
...
src/errors.rs
View file @
0dae2f19
use
chan_signal
::
Signal
;
error_chain!
{
error_chain!
{
types
{
Error
,
ErrorKind
,
ResultExt
,
Result
;
}
...
...
src/index.rs
View file @
0dae2f19
...
...
@@ -51,7 +51,8 @@ impl TxInRow {
code
:
b
'I'
,
prev_hash_prefix
:
hash_prefix
(
&
txid
[
..
]),
prev_index
:
output_index
as
u16
,
})
.unwrap
()
})
.unwrap
()
}
pub
fn
to_row
(
&
self
)
->
Row
{
...
...
@@ -93,7 +94,8 @@ impl TxOutRow {
bincode
::
serialize
(
&
TxOutKey
{
code
:
b
'O'
,
script_hash_prefix
:
hash_prefix
(
&
script_hash
[
..
HASH_PREFIX_LEN
]),
})
.unwrap
()
})
.unwrap
()
}
pub
fn
to_row
(
&
self
)
->
Row
{
...
...
@@ -194,7 +196,8 @@ pub fn index_block(block: &Block, height: usize) -> Vec<Row> {
key
:
bincode
::
serialize
(
&
BlockKey
{
code
:
b
'B'
,
hash
:
full_hash
(
&
blockhash
[
..
]),
})
.unwrap
(),
})
.unwrap
(),
value
:
serialize
(
&
block
.header
),
});
rows
...
...
src/mempool.rs
View file @
0dae2f19
...
...
@@ -205,7 +205,8 @@ impl Tracker {
None
// ignore this transaction for now
}
}
})
.collect
();
})
.collect
();
if
entries
.is_empty
()
{
return
Ok
(());
}
...
...
src/rpc.rs
View file @
0dae2f19
...
...
@@ -44,7 +44,8 @@ fn unspent_from_status(status: &Status) -> Value {
"tx_pos"
:
out
.output_index
,
"tx_hash"
:
out
.txn_id
.be_hex_string
(),
"value"
:
out
.value
,
}))
.collect
()
}))
.collect
()
))
}
...
...
@@ -492,14 +493,16 @@ impl RPC {
for
msg
in
notification
.receiver
()
.iter
()
{
let
mut
senders
=
senders
.lock
()
.unwrap
();
match
msg
{
Notification
::
Periodic
=>
for
sender
in
senders
.split_off
(
0
)
{
if
let
Err
(
TrySendError
::
Disconnected
(
_
))
=
sender
.try_send
(
Message
::
PeriodicUpdate
)
{
continue
;
Notification
::
Periodic
=>
{
for
sender
in
senders
.split_off
(
0
)
{
if
let
Err
(
TrySendError
::
Disconnected
(
_
))
=
sender
.try_send
(
Message
::
PeriodicUpdate
)
{
continue
;
}
senders
.push
(
sender
);
}
senders
.push
(
sender
);
},
}
Notification
::
Exit
=>
acceptor
.send
(
None
)
.unwrap
(),
}
}
...
...
src/util.rs
View file @
0dae2f19
...
...
@@ -113,7 +113,8 @@ impl HeaderList {
height
:
height
,
hash
:
hashed_header
.blockhash
,
header
:
hashed_header
.header
,
})
.collect
()
})
.collect
()
}
pub
fn
apply
(
&
mut
self
,
new_headers
:
Vec
<
HeaderEntry
>
)
{
...
...
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