-
Notifications
You must be signed in to change notification settings - Fork 411
Adds Txid to lighting-block-sync::convert #1037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1037 +/- ##
==========================================
+ Coverage 90.80% 90.81% +0.01%
==========================================
Files 61 65 +4
Lines 31582 32843 +1261
==========================================
+ Hits 28678 29828 +1150
- Misses 2904 3015 +111
Continue to review full report at Codecov.
|
lightning-block-sync/src/convert.rs
Outdated
impl TryInto<Txid> for JsonResponse { | ||
type Error = std::io::Error; | ||
fn try_into(self) -> std::io::Result<Txid> { | ||
match self.0.as_str() { | ||
None => Err(std::io::Error::new( | ||
std::io::ErrorKind::InvalidData, | ||
"expected JSON string", | ||
)), | ||
Some(hex_data) => match Vec::<u8>::from_hex(hex_data) { | ||
Err(_) => Err(std::io::Error::new( | ||
std::io::ErrorKind::InvalidData, | ||
"invalid hex data", | ||
)), | ||
Ok(txid_data) => match encode::deserialize(&txid_data) { | ||
Err(_) => Err(std::io::Error::new( | ||
std::io::ErrorKind::InvalidData, | ||
"invalid txid", | ||
)), | ||
Ok(txid) => Ok(txid), | ||
}, | ||
}, | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you need tabs not spaces. Likewise in the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ACK this PR mod the tabs-to-spaces Jeff pointed out
1224597
to
f65d05c
Compare
@jkczyz @valentinewallace should be good now. |
Adds
TryInto<Txid> for JsonResponse
.Related to lightningdevkit/ldk-sample#28 (see lightningdevkit/ldk-sample#28 (comment)).