fix(signer): respect allow_all_sighashes in SignerWrapper::sign_input#476
fix(signer): respect allow_all_sighashes in SignerWrapper::sign_input#476muhahahmad68 wants to merge 1 commit intobitcoindevkit:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #476 +/- ##
==========================================
+ Coverage 80.05% 80.07% +0.01%
==========================================
Files 24 24
Lines 5360 5369 +9
Branches 244 249 +5
==========================================
+ Hits 4291 4299 +8
Misses 990 990
- Partials 79 80 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a187c70 to
3f07adc
Compare
| ); | ||
|
|
||
| psbt.inputs[0].sighash_type = Some(TapSighashType::All.into()); | ||
| assert_ne!( |
There was a problem hiding this comment.
instead of these assert_ne!s it'd be more readable if you're asserting if it is Ok(())
here and below
|
|
||
| psbt.inputs[0].sighash_type = Some(TapSighashType::Default.into()); | ||
| assert_ne!( | ||
| signer.sign_input(&mut psbt, 0, &opts_reject, &secp), |
There was a problem hiding this comment.
after you've had one successful sig, it'll always succeed because it is already signed. you also need to clear out the signatures before each. Imo would be cleanest to start with base_psbt and for each assertion clone it and make modifications as you need, that way you don't have any risk of secondary effects
|
Makes more sense, I'll effect the changes as suggested. Much thanks @benthecarman |
3f07adc to
8c6d411
Compare
Description
SignOptions::allow_all_sighashesis documented as controlling whether the signer will accept non-SIGHASH_ALLsighash types. However, the check only existed insideWallet::signas a PSBT-wide pre-flight guard. The underlyingSignerWrapper<PrivateKey>::sign_inputnever consulted it, meaning callers usingInputSignerorTransactionSignerdirectly could bypass the check entirely.Added a sighash guard in
SignerWrapper<PrivateKey>::sign_inputbefore thematch self.ctxdispatch. This ensures the check covers all signing contexts (Legacy, Segwitv0, Taproot) and all delegating implementations in a single place.Tests Added
SIGHASH_NONEandallow_all_sighashes: falsereturnsNonStandardSighashallow_all_sighashes: truepasses the guard successfullyFixes #469
Checklists
All Submissions:
just pbefore pushingNew Features:
Bugfixes: