mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
add any dns payment instructions from loaded psbts if not already cached
This commit is contained in:
parent
2ff7a15d1e
commit
d81b868049
1 changed files with 19 additions and 4 deletions
|
|
@ -3,13 +3,13 @@ package com.sparrowwallet.sparrow;
|
||||||
import com.beust.jcommander.JCommander;
|
import com.beust.jcommander.JCommander;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.sparrowwallet.drongo.*;
|
import com.sparrowwallet.drongo.*;
|
||||||
|
import com.sparrowwallet.drongo.address.Address;
|
||||||
import com.sparrowwallet.drongo.crypto.*;
|
import com.sparrowwallet.drongo.crypto.*;
|
||||||
|
import com.sparrowwallet.drongo.dns.DnsPayment;
|
||||||
|
import com.sparrowwallet.drongo.dns.DnsPaymentCache;
|
||||||
import com.sparrowwallet.drongo.policy.PolicyType;
|
import com.sparrowwallet.drongo.policy.PolicyType;
|
||||||
import com.sparrowwallet.drongo.protocol.*;
|
import com.sparrowwallet.drongo.protocol.*;
|
||||||
import com.sparrowwallet.drongo.psbt.PSBT;
|
import com.sparrowwallet.drongo.psbt.*;
|
||||||
import com.sparrowwallet.drongo.psbt.PSBTInput;
|
|
||||||
import com.sparrowwallet.drongo.psbt.PSBTParseException;
|
|
||||||
import com.sparrowwallet.drongo.psbt.PSBTSignatureException;
|
|
||||||
import com.sparrowwallet.drongo.wallet.*;
|
import com.sparrowwallet.drongo.wallet.*;
|
||||||
import com.sparrowwallet.hummingbird.UR;
|
import com.sparrowwallet.hummingbird.UR;
|
||||||
import com.sparrowwallet.hummingbird.registry.CryptoPSBT;
|
import com.sparrowwallet.hummingbird.registry.CryptoPSBT;
|
||||||
|
|
@ -1916,6 +1916,21 @@ public class AppController implements Initializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Add DNS payment information if not already cached
|
||||||
|
for(PSBTOutput psbtOutput : psbt.getPsbtOutputs()) {
|
||||||
|
if(psbtOutput.getDnssecProof() != null && !psbtOutput.getDnssecProof().isEmpty() && psbtOutput.getScript() != null) {
|
||||||
|
Address address = psbtOutput.getScript().getToAddress();
|
||||||
|
if(address != null && DnsPaymentCache.getDnsPayment(address) == null) {
|
||||||
|
try {
|
||||||
|
Optional<DnsPayment> optDnsPayment = psbtOutput.getDnsPayment();
|
||||||
|
optDnsPayment.ifPresent(dnsPayment -> DnsPaymentCache.putDnsPayment(address, dnsPayment));
|
||||||
|
} catch(Exception e) {
|
||||||
|
log.debug("Error resolving DNS payment", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Window psbtWalletWindow = AppServices.get().getWindowForPSBT(psbt);
|
Window psbtWalletWindow = AppServices.get().getWindowForPSBT(psbt);
|
||||||
if(psbtWalletWindow != null && !tabs.getScene().getWindow().equals(psbtWalletWindow)) {
|
if(psbtWalletWindow != null && !tabs.getScene().getWindow().equals(psbtWalletWindow)) {
|
||||||
EventManager.get().post(new ViewPSBTEvent(psbtWalletWindow, name, file, psbt));
|
EventManager.get().post(new ViewPSBTEvent(psbtWalletWindow, name, file, psbt));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue