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

2
drongo

@ -1 +1 @@
Subproject commit af562dad1022c24d5ff851100cc3958a852fbec8 Subproject commit 8bc4e3b3dcf4c826d148aeafd556ecdbe8673939

View file

@ -156,13 +156,7 @@ public class InputController extends TransactionFormController implements Initia
from.setVisible(false); from.setVisible(false);
if(psbtInput != null) { if(psbtInput != null) {
TransactionOutput output = null; TransactionOutput output = psbtInput.getUtxo();
if(psbtInput.getNonWitnessUtxo() != null) {
output = psbtInput.getNonWitnessUtxo().getOutputs().get(txInput.getIndex());
} else if(psbtInput.getWitnessUtxo() != null) {
output = psbtInput.getWitnessUtxo();
}
updateSpends(output); updateSpends(output);
} else if(inputForm.getInputTransactions() != null) { } else if(inputForm.getInputTransactions() != null) {
updateSpends(inputForm.getInputTransactions()); updateSpends(inputForm.getInputTransactions());
@ -299,7 +293,7 @@ public class InputController extends TransactionFormController implements Initia
PSBTInput psbtInput = inputForm.getPsbtInput(); PSBTInput psbtInput = inputForm.getPsbtInput();
int reqSigs = -1; int reqSigs = -1;
if((psbtInput.getNonWitnessUtxo() != null || psbtInput.getWitnessUtxo() != null) && psbtInput.getSigningScript() != null) { if(psbtInput.getUtxo() != null && psbtInput.getSigningScript() != null) {
try { try {
reqSigs = psbtInput.getSigningScript().getNumRequiredSignatures(); reqSigs = psbtInput.getSigningScript().getNumRequiredSignatures();
} catch (NonStandardScriptException e) { } catch (NonStandardScriptException e) {

View file

@ -56,17 +56,13 @@ public class InputsController extends TransactionFormController implements Initi
boolean showDenominator = true; boolean showDenominator = true;
List<TransactionOutput> outputs = new ArrayList<>(); List<TransactionOutput> outputs = new ArrayList<>();
for(int i = 0; i < tx.getInputs().size(); i++) { for(PSBTInput psbtInput : inputsForm.getPsbt().getPsbtInputs()) {
TransactionInput input = tx.getInputs().get(i); TransactionOutput output = psbtInput.getUtxo();
PSBTInput psbtInput = inputsForm.getPsbt().getPsbtInputs().get(i); if(output != null) {
outputs.add(output);
if(psbtInput.getNonWitnessUtxo() != null) {
outputs.add(psbtInput.getNonWitnessUtxo().getOutputs().get((int)input.getOutpoint().getIndex()));
} else if(psbtInput.getWitnessUtxo() != null) {
outputs.add(psbtInput.getWitnessUtxo());
} }
if((psbtInput.getNonWitnessUtxo() != null || psbtInput.getWitnessUtxo() != null) && psbtInput.getSigningScript() != null) { if(psbtInput.getUtxo() != null && psbtInput.getSigningScript() != null) {
try { try {
reqSigs += psbtInput.getSigningScript().getNumRequiredSignatures(); reqSigs += psbtInput.getSigningScript().getNumRequiredSignatures();
} catch (NonStandardScriptException e) { } catch (NonStandardScriptException e) {