Skip to content

Commit b6b2fea

Browse files
committed
Merge #481: Make numeric error conversion consistent
294b0e5 Make numeric error conversion consistent (Jamil Lambert, PhD) Pull request description: Most of the repo uses a bare `?` operator in numeric type conversion, but some places use `.map_err(E::Numeric)?`. Use the bare `?` operator everywhere for consistency. ACKs for top commit: tcharding: ACK 294b0e5 Tree-SHA512: 33aa57acf496915a762f5ef38ae9d987e2ce10c1bf067779c91c275420dc633388660f7f44d2f0e140e433ebcf769bd167fd8d356f08cf694c439b231ffcdbd7
2 parents 7fa9763 + 294b0e5 commit b6b2fea

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

types/src/v26/blockchain/into.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ impl GetChainStates {
1515
use GetChainStatesError as E;
1616

1717
Ok(model::GetChainStates {
18-
headers: crate::to_u32(self.headers, "headers").map_err(E::Numeric)?,
18+
headers: crate::to_u32(self.headers, "headers")?,
1919
chain_states: self
2020
.chain_states
2121
.into_iter()
2222
.map(|s| {
2323
Ok(model::ChainState {
24-
blocks: crate::to_u32(s.blocks, "blocks").map_err(E::Numeric)?,
24+
blocks: crate::to_u32(s.blocks, "blocks")?,
2525
best_block_hash: s.best_block_hash.parse().map_err(E::BestBlockHash)?,
2626
bits: None, // v29 and later only.
2727
target: None, // v29 and later only.

types/src/v29/blockchain/into.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,13 @@ impl GetChainStates {
176176
use GetChainStatesError as E;
177177

178178
Ok(model::GetChainStates {
179-
headers: crate::to_u32(self.headers, "headers").map_err(E::Numeric)?,
179+
headers: crate::to_u32(self.headers, "headers")?,
180180
chain_states: self
181181
.chain_states
182182
.into_iter()
183183
.map(|s| {
184184
Ok(model::ChainState {
185-
blocks: crate::to_u32(s.blocks, "blocks").map_err(E::Numeric)?,
185+
blocks: crate::to_u32(s.blocks, "blocks")?,
186186
best_block_hash: s.best_block_hash.parse().map_err(E::BestBlockHash)?,
187187
bits: Some(CompactTarget::from_unprefixed_hex(&s.bits).map_err(E::Bits)?),
188188
target: Some(

0 commit comments

Comments
 (0)