diff --git a/lib/src/transaction.dart b/lib/src/transaction.dart index d37bfd7..87c43bd 100644 --- a/lib/src/transaction.dart +++ b/lib/src/transaction.dart @@ -560,7 +560,7 @@ class Input { factory Input.expandInput(Uint8List scriptSig, List witness, [String type, Uint8List scriptPubKey]) { - if (type == null || type == '') { + if (type == null) { var ssType = classifyInput(scriptSig); var wsType = classifyWitness(witness); if (ssType == SCRIPT_TYPES['NONSTANDARD']) ssType = null; @@ -588,6 +588,10 @@ class Input { pubkeys: [], signatures: [p2pk.data.signature]); } + return Input( + prevOutType: SCRIPT_TYPES['NONSTANDARD'], + prevOutScript: scriptSig, + ); } factory Input.clone(Input input) { diff --git a/lib/src/transaction_builder.dart b/lib/src/transaction_builder.dart index 2ff61bf..aa9212e 100644 --- a/lib/src/transaction_builder.dart +++ b/lib/src/transaction_builder.dart @@ -339,9 +339,8 @@ class TransactionBuilder { if (options.script != null) { input = Input.expandInput(options.script, options.witness ?? EMPTY_WITNESS); - } else { - input = new Input(); } + if (input == null) input = Input(); if (options.value != null) input.value = options.value; if (input.prevOutScript == null && options.prevOutScript != null) { if (input.pubkeys == null && input.signatures == null) {