File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -5,22 +5,26 @@ var typeforce = require('typeforce')
55
66function check ( script , allowIncomplete ) {
77 var chunks = bscript . decompile ( script )
8- if ( chunks . length < 2 ) return false
8+ if ( chunks . length < 1 ) return false
99
1010 var lastChunk = chunks [ chunks . length - 1 ]
1111 if ( ! Buffer . isBuffer ( lastChunk ) ) return false
1212
1313 var scriptSigChunks = chunks . slice ( 0 , - 1 )
1414 var redeemScriptChunks = bscript . decompile ( lastChunk )
1515
16- // is redeemScript a valid script?
16+ // is redeemScript a valid script?git
1717 if ( redeemScriptChunks . length === 0 ) return false
1818
1919 // is redeemScriptSig push only?
2020 if ( ! bscript . isPushOnly ( scriptSigChunks ) ) return false
2121
2222 var inputType = bscript . classifyInput ( scriptSigChunks , allowIncomplete )
2323 var outputType = bscript . classifyOutput ( redeemScriptChunks )
24+ if ( chunks . length === 1 && ( outputType === bscript . types . P2WSH || outputType === bscript . types . P2WPKH ) ) {
25+ return true
26+ }
27+
2428 return inputType === outputType
2529}
2630check . toJSON = function ( ) { return 'scriptHash input' }
Original file line number Diff line number Diff line change @@ -346,7 +346,6 @@ describe('TransactionBuilder', function () {
346346 it ( 'does not throw if buildIncomplete' , function ( ) {
347347 var txb
348348 if ( f . txHex ) {
349- console . log ( f . txHex )
350349 txb = TransactionBuilder . fromTransaction ( Transaction . fromHex ( f . txHex ) )
351350 } else {
352351 txb = construct ( f )
You can’t perform that action at this time.
0 commit comments