@@ -364,17 +364,13 @@ export class Psbt {
364364
365365 checkPartialSigSighashes ( input ) ;
366366
367- if ( isTapscript && ! finalScriptsFunc )
368- throw new Error (
369- `Taproot script-path finalizer required for input #${ inputIndex } ` ,
370- ) ;
371-
372367 const fn = finalScriptsFunc || getFinalScripts ;
373368 const { finalScriptSig, finalScriptWitness } = fn (
374369 inputIndex ,
375370 input ,
376371 script ,
377372 isSegwit ,
373+ isTapscript ,
378374 isP2SH ,
379375 isP2WSH ,
380376 this . __CACHE . __EC_LIB ,
@@ -1224,6 +1220,7 @@ type FinalScriptsFunc = (
12241220 input : PsbtInput , // The PSBT input contents
12251221 script : Buffer , // The "meaningful" locking script Buffer (redeemScript for P2SH etc.)
12261222 isSegwit : boolean , // Is it segwit?
1223+ isTapscript : boolean , // Is taproot script path?
12271224 isP2SH : boolean , // Is it P2SH?
12281225 isP2WSH : boolean , // Is it P2WSH?
12291226 eccLib ?: TinySecp256k1Interface , // optional lib for checking taproot validity
@@ -1237,6 +1234,7 @@ function getFinalScripts(
12371234 input : PsbtInput ,
12381235 script : Buffer ,
12391236 isSegwit : boolean ,
1237+ isTapscript : boolean ,
12401238 isP2SH : boolean ,
12411239 isP2WSH : boolean ,
12421240 eccLib ?: TinySecp256k1Interface ,
@@ -1245,7 +1243,7 @@ function getFinalScripts(
12451243 finalScriptWitness : Buffer | undefined ;
12461244} {
12471245 const scriptType = classifyScript ( script , eccLib ) ;
1248- if ( ! canFinalize ( input , script , scriptType ) )
1246+ if ( isTapscript || ! canFinalize ( input , script , scriptType ) )
12491247 throw new Error ( `Can not finalize input #${ inputIndex } ` ) ;
12501248 return prepareFinalScripts (
12511249 script ,
0 commit comments