Repository navigation
fix(create_sp_tx): propagate errors instead of panicking - #388
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #388 +/- ##
==========================================
+ Coverage 59.63% 59.78% +0.14%
==========================================
Files 25 25
Lines 4544 4550 +6
==========================================
+ Hits 2710 2720 +10
+ Misses 1834 1830 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tvpeter
left a comment
There was a problem hiding this comment.
Thank you @bvotteler for working on this fix.
I have left some comments
|
Also, please fix the PR title, it does not follow the Conventional Commit style. |
f4b737b to
386b61e
Compare
|
Please rebase and ensure all CI tests are passing. |
Remove .expect() and unimplemented!() calls and replace them with errors. Wrap errors from derive_sp(). Return generic errors for the remaining cases.
Expect an error message to be propagated from derive_sp, wrapped with explanation that it occurred during silent payment transaction creation.
386b61e to
19a12c1
Compare
Rebased and force pushed. I didn't try to run the |
Description
Fixes #380.
Propagate an error rather than panic when
derive_spreturns an error insidecreate_sp_tx.This is done by:
From<SpSendError>forBDKCliErrorderive_sp([..]).expect([..]);withderive_sp([..])?;Expand: output before & after
Output before:
(For output with backtrace, see issue description for #380)
Output after:
$ target/debug/bdk-cli wallet --wallet wsh_wallet create_sp_tx \ --to-sp sprt1qqtnxgt7kn0fpr7fl0u0ndjj35f499y8t9hgmpkp8n2rmkr2gpjzyxqe3qp5n5apt0c5fas9xwy7002l0zqsuhrv7y9clz8yvhnmvut83lypguwer:20000 Error: Cannot create silent payment transaction: No available inputs for shared secret derivationNotes to the reviewers
The propagation method will do the same, either way. Therefore, I didn't try too hard to fabricate those scenarios. Happy to address that if preferred.
tests/integration/online.rsdespite the handler being insrc/handlers/offline.rs, simply because that is where the currently existing silent payment tests live.Happy to move the test to
tests/integrtion/offlineif that is preferable.Checklists
All Submissions:
cargo fmtandcargo clippybefore committingBugfixes: