File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -425,6 +425,26 @@ PSBTError SignPSBTInput(const SigningProvider& provider, PartiallySignedTransact
425425 return PSBTError::SIGHASH_MISMATCH;
426426 }
427427
428+ // Check all existing signatures use the sighash type
429+ if (sighash == SIGHASH_DEFAULT) {
430+ if (!input.m_tap_key_sig .empty () && input.m_tap_key_sig .size () != 64 ) {
431+ return PSBTError::SIGHASH_MISMATCH;
432+ }
433+ for (const auto & [_, sig] : input.m_tap_script_sigs ) {
434+ if (sig.size () != 64 ) return PSBTError::SIGHASH_MISMATCH;
435+ }
436+ } else {
437+ if (!input.m_tap_key_sig .empty () && (input.m_tap_key_sig .size () != 65 || input.m_tap_key_sig .back () != *sighash)) {
438+ return PSBTError::SIGHASH_MISMATCH;
439+ }
440+ for (const auto & [_, sig] : input.m_tap_script_sigs ) {
441+ if (sig.size () != 65 || sig.back () != *sighash) return PSBTError::SIGHASH_MISMATCH;
442+ }
443+ for (const auto & [_, sig] : input.partial_sigs ) {
444+ if (sig.second .back () != *sighash) return PSBTError::SIGHASH_MISMATCH;
445+ }
446+ }
447+
428448 sigdata.witness = false ;
429449 bool sig_complete;
430450 if (txdata == nullptr ) {
You can’t perform that action at this time.
0 commit comments