mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
fix cormorant server.version rpc issue
This commit is contained in:
parent
890f0476b1
commit
c265fd1969
2 changed files with 5 additions and 4 deletions
|
|
@ -39,7 +39,7 @@ public class SimpleElectrumServerRpc implements ElectrumServerRpc {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getServerVersion(Transport transport, String clientName, String[] supportedVersions) {
|
public List<String> getServerVersion(Transport transport, String clientName, String[] supportedVersions) {
|
||||||
if(Config.get().isLegacyServer()) {
|
if(Config.get().getServerType() == ServerType.ELECTRUM_SERVER && Config.get().isLegacyServer()) {
|
||||||
return getLegacyServerVersion(transport, clientName);
|
return getLegacyServerVersion(transport, clientName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,11 @@ public class ElectrumServerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonRpcMethod("server.version")
|
@JsonRpcMethod("server.version")
|
||||||
public List<String> getServerVersion(@JsonRpcParam("client_name") String clientName, @JsonRpcParam("protocol_version") String protocolVersion) throws UnsupportedVersionException {
|
public List<String> getServerVersion(@JsonRpcParam("client_name") String clientName, @JsonRpcParam("protocol_version") String[] protocolVersion) throws UnsupportedVersionException {
|
||||||
Version clientVersion = new Version(protocolVersion);
|
String version = protocolVersion.length > 1 ? protocolVersion[1] : protocolVersion[0];
|
||||||
|
Version clientVersion = new Version(version);
|
||||||
if(clientVersion.compareTo(VERSION) < 0) {
|
if(clientVersion.compareTo(VERSION) < 0) {
|
||||||
throw new UnsupportedVersionException(protocolVersion);
|
throw new UnsupportedVersionException(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
return List.of(Cormorant.SERVER_NAME + " " + SparrowWallet.APP_VERSION, VERSION.get());
|
return List.of(Cormorant.SERVER_NAME + " " + SparrowWallet.APP_VERSION, VERSION.get());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue