mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
avoid saving frequently changing tls certificates for blockchain.info public servers to avoid approval complacency
This commit is contained in:
parent
f4c8bfa48c
commit
7e91f57a42
1 changed files with 10 additions and 1 deletions
|
@ -94,7 +94,7 @@ public class TcpOverTlsTransport extends TcpTransport {
|
|||
|
||||
protected void startHandshake(SSLSocket sslSocket) throws IOException {
|
||||
sslSocket.addHandshakeCompletedListener(event -> {
|
||||
if(Storage.getCertificateFile(server.getHost()) == null) {
|
||||
if(shouldSaveCertificate()) {
|
||||
try {
|
||||
Certificate[] certs = event.getPeerCertificates();
|
||||
if(certs.length > 0) {
|
||||
|
@ -108,4 +108,13 @@ public class TcpOverTlsTransport extends TcpTransport {
|
|||
|
||||
sslSocket.startHandshake();
|
||||
}
|
||||
|
||||
protected boolean shouldSaveCertificate() {
|
||||
//Avoid saving the certificates for blockstream.info public servers - they change too often and encourage approval complacency
|
||||
if(PublicElectrumServer.BLOCKSTREAM_INFO.getName().equals(server.getHost()) || PublicElectrumServer.ELECTRUM_BLOCKSTREAM_INFO.getName().equals(server.getHost())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Storage.getCertificateFile(server.getHost()) == null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue