mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-26 10:06:45 +00:00
allow psbts without previous utxo data
This commit is contained in:
parent
b2f5f5ffeb
commit
ce90e29284
1 changed files with 12 additions and 14 deletions
|
@ -341,12 +341,7 @@ public class PSBT {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(verifySignatures) {
|
if(verifySignatures) {
|
||||||
for(PSBTInput input : psbtInputs) {
|
verifySignatures(psbtInputs);
|
||||||
boolean verified = input.verifySignatures();
|
|
||||||
if(!verified && input.getPartialSignatures().size() > 0) {
|
|
||||||
throw new PSBTSignatureException("Unverifiable partial signatures provided");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +377,7 @@ public class PSBT {
|
||||||
if(utxo != null) {
|
if(utxo != null) {
|
||||||
fee += utxo.getValue();
|
fee += utxo.getValue();
|
||||||
} else {
|
} else {
|
||||||
log.error("Cannot determine fee - not enough information provided on inputs");
|
log.warn("Cannot determine fee - inputs are missing UTXO data");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,14 +391,17 @@ public class PSBT {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifySignatures() throws PSBTSignatureException {
|
public void verifySignatures() throws PSBTSignatureException {
|
||||||
for(PSBTInput input : getPsbtInputs()) {
|
verifySignatures(getPsbtInputs());
|
||||||
boolean verified = input.verifySignatures();
|
|
||||||
if(!verified) {
|
|
||||||
if(input.getPartialSignatures().size() > 0) {
|
|
||||||
throw new PSBTSignatureException("Unverifiable partial signatures provided");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new PSBTSignatureException("No UTXO data provided");
|
private void verifySignatures(List<PSBTInput> psbtInputs) throws PSBTSignatureException {
|
||||||
|
for(PSBTInput input : psbtInputs) {
|
||||||
|
boolean verified = input.verifySignatures();
|
||||||
|
if(!verified && input.getPartialSignatures().size() > 0) {
|
||||||
|
throw new PSBTSignatureException("Unverifiable partial signatures provided");
|
||||||
|
}
|
||||||
|
if(!verified && input.isTaproot() && input.getTapKeyPathSignature() != null) {
|
||||||
|
throw new PSBTSignatureException("Unverifiable taproot keypath signature provided");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue