Use ok_or for constants, rather than a redudant closure
* Use ok_or for constants in zebra-network * Use ok_or for constants in zebra-consensus
This commit is contained in:
parent
88557ddd0a
commit
b5c653ed93
|
|
@ -15,7 +15,7 @@ pub fn is_coinbase_first(block: &Block) -> Result<(), Error> {
|
||||||
let first = block
|
let first = block
|
||||||
.transactions
|
.transactions
|
||||||
.get(0)
|
.get(0)
|
||||||
.ok_or_else(|| "block has no transactions")?;
|
.ok_or("block has no transactions")?;
|
||||||
let mut rest = block.transactions.iter().skip(1);
|
let mut rest = block.transactions.iter().skip(1);
|
||||||
if !first.is_coinbase() {
|
if !first.is_coinbase() {
|
||||||
return Err("first transaction must be coinbase".into());
|
return Err("first transaction must be coinbase".into());
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ where
|
||||||
let remote_msg = stream
|
let remote_msg = stream
|
||||||
.next()
|
.next()
|
||||||
.await
|
.await
|
||||||
.ok_or_else(|| HandshakeError::ConnectionClosed)??;
|
.ok_or(HandshakeError::ConnectionClosed)??;
|
||||||
|
|
||||||
// Check that we got a Version and destructure its fields into the local scope.
|
// Check that we got a Version and destructure its fields into the local scope.
|
||||||
debug!(?remote_msg, "got message from remote peer");
|
debug!(?remote_msg, "got message from remote peer");
|
||||||
|
|
@ -295,7 +295,7 @@ where
|
||||||
let remote_msg = stream
|
let remote_msg = stream
|
||||||
.next()
|
.next()
|
||||||
.await
|
.await
|
||||||
.ok_or_else(|| HandshakeError::ConnectionClosed)??;
|
.ok_or(HandshakeError::ConnectionClosed)??;
|
||||||
if let Message::Verack = remote_msg {
|
if let Message::Verack = remote_msg {
|
||||||
debug!("got verack from remote peer");
|
debug!("got verack from remote peer");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue