cleanup psbt utxo fetching

This commit is contained in:
Craig Raw
2020-07-23 13:39:35 +02:00
parent 279b0e0ac1
commit 33d6da8a99
3 changed files with 8 additions and 18 deletions
+1 -1
Submodule drongo updated: af562dad10...8bc4e3b3dc
@@ -156,13 +156,7 @@ public class InputController extends TransactionFormController implements Initia
from.setVisible(false);
if(psbtInput != null) {
TransactionOutput output = null;
if(psbtInput.getNonWitnessUtxo() != null) {
output = psbtInput.getNonWitnessUtxo().getOutputs().get(txInput.getIndex());
} else if(psbtInput.getWitnessUtxo() != null) {
output = psbtInput.getWitnessUtxo();
}
TransactionOutput output = psbtInput.getUtxo();
updateSpends(output);
} else if(inputForm.getInputTransactions() != null) {
updateSpends(inputForm.getInputTransactions());
@@ -299,7 +293,7 @@ public class InputController extends TransactionFormController implements Initia
PSBTInput psbtInput = inputForm.getPsbtInput();
int reqSigs = -1;
if((psbtInput.getNonWitnessUtxo() != null || psbtInput.getWitnessUtxo() != null) && psbtInput.getSigningScript() != null) {
if(psbtInput.getUtxo() != null && psbtInput.getSigningScript() != null) {
try {
reqSigs = psbtInput.getSigningScript().getNumRequiredSignatures();
} catch (NonStandardScriptException e) {
@@ -56,17 +56,13 @@ public class InputsController extends TransactionFormController implements Initi
boolean showDenominator = true;
List<TransactionOutput> outputs = new ArrayList<>();
for(int i = 0; i < tx.getInputs().size(); i++) {
TransactionInput input = tx.getInputs().get(i);
PSBTInput psbtInput = inputsForm.getPsbt().getPsbtInputs().get(i);
if(psbtInput.getNonWitnessUtxo() != null) {
outputs.add(psbtInput.getNonWitnessUtxo().getOutputs().get((int)input.getOutpoint().getIndex()));
} else if(psbtInput.getWitnessUtxo() != null) {
outputs.add(psbtInput.getWitnessUtxo());
for(PSBTInput psbtInput : inputsForm.getPsbt().getPsbtInputs()) {
TransactionOutput output = psbtInput.getUtxo();
if(output != null) {
outputs.add(output);
}
if((psbtInput.getNonWitnessUtxo() != null || psbtInput.getWitnessUtxo() != null) && psbtInput.getSigningScript() != null) {
if(psbtInput.getUtxo() != null && psbtInput.getSigningScript() != null) {
try {
reqSigs += psbtInput.getSigningScript().getNumRequiredSignatures();
} catch (NonStandardScriptException e) {