Check recent blocks are not empty - #1725
Conversation
oleonardolima
left a comment
There was a problem hiding this comment.
It looks good, but it seems to partially address the problem.
I'm trying to wrap my mind on the behavior when the latest_blocks is empty. I wonder if it shouldn't be handled on the upstream fns too?
Otherwise, the same rogue Esplora server would still be able to crash the application as we expect to have a valid point of agreement here:
bdk/crates/esplora/src/blocking_ext.rs
Line 225 in 3bc45b5
|
That's a good point. I think these |
942e5c1 to
f3efbda
Compare
oleonardolima
left a comment
There was a problem hiding this comment.
Concept ACK f3efbda
|
Can you add a simple test to exercise this condition in case we change the fix implementation later we make sure this remains fixed. I also had some discussion with @oleonardolima and @ValuedMammal and it would be good to have the test first and make sure without any changes this does in fact gets to and fails an at expect. |
|
I can try to work on that tomorrow. Heads up I will not be able to work on much next week |
|
Since the checkpoint is an optional field of the sync/scan response it may also make sense to have |
|
I was thinking that this should be an error variant in the Esplora client, as it should not ever respond with empty blocks when requested. I am unable to do much this week but I can review any new PRs that replace this one |
| if latest_blocks.is_empty() { | ||
| return Ok(local_tip.clone()); | ||
| } |
There was a problem hiding this comment.
Please include docs explaining why we are doing this.
|
I'm thinking, if the server does something unexpected, maybe it is best to error out? Otherwise there is no way the caller will figure it out. |
Right, I agree, but that would push the error variant into |
|
Would be resolved by bitcoindevkit/rust-esplora-client#113 |
|
Closed by bitcoindevkit/rust-esplora-client#113 |
Closes #1696
Checklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features:
Bugfixes: