mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Ensure RPC client works with Bitcoin Core 0.21.0
Add missing 'connections_(in|out)' JSON properties to NetworkInfo that came with the recent 0.21.0 release of Bitcoin Core. Also ensure that unrecognised JSON properties are ignored, so that future changes to the RPC API are less likely to break our client. Also, for the benefit of the tests, change the JSON property order of RawInput to better match observed 'getblock' responses. (It appears that in 0.21.0, extra "txinwitness" fields have started appearing in coinbase inputs, which may be a bug.)
This commit is contained in:
parent
1abf4c5d96
commit
a8b0863264
@ -74,7 +74,7 @@ public class RpcService {
|
||||
private static final int ACTIVATE_HARD_FORK_2_HEIGHT_MAINNET = 672646;
|
||||
private static final int ACTIVATE_HARD_FORK_2_HEIGHT_TESTNET = 1906689;
|
||||
private static final int ACTIVATE_HARD_FORK_2_HEIGHT_REGTEST = 1;
|
||||
private static final Range<Integer> SUPPORTED_NODE_VERSION_RANGE = Range.closedOpen(180000, 210000);
|
||||
private static final Range<Integer> SUPPORTED_NODE_VERSION_RANGE = Range.closedOpen(180000, 210100);
|
||||
|
||||
private final String rpcUser;
|
||||
private final String rpcPassword;
|
||||
|
@ -117,6 +117,7 @@ public interface BitcoindClient {
|
||||
|
||||
var httpClient = new JsonRpcHttpClient(
|
||||
new ObjectMapper()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||
.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, true),
|
||||
new URL("http", rpcHost, rpcPort, "", urlStreamHandler),
|
||||
headers) {
|
||||
|
@ -34,8 +34,8 @@ import lombok.RequiredArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({"version", "subversion", "protocolversion", "localservices", "localservicesnames", "localrelay",
|
||||
"timeoffset", "networkactive", "connections", "networks", "relayfee", "incrementalfee", "localaddresses",
|
||||
"warnings"})
|
||||
"timeoffset", "networkactive", "connections", "connections_in", "connections_out", "networks", "relayfee",
|
||||
"incrementalfee", "localaddresses", "warnings"})
|
||||
public class NetworkInfo {
|
||||
private Integer version;
|
||||
@JsonProperty("subversion")
|
||||
@ -53,6 +53,10 @@ public class NetworkInfo {
|
||||
@JsonProperty("networkactive")
|
||||
private Boolean networkActive;
|
||||
private Integer connections;
|
||||
@JsonProperty("connections_in")
|
||||
private Integer connectionsIn;
|
||||
@JsonProperty("connections_out")
|
||||
private Integer connectionsOut;
|
||||
private List<Network> networks;
|
||||
@JsonProperty("relayfee")
|
||||
private Double relayFee;
|
||||
|
@ -31,15 +31,15 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonPropertyOrder({"txid", "vout", "scriptSig", "txinwitness", "coinbase", "sequence"})
|
||||
@JsonPropertyOrder({"txid", "vout", "coinbase", "scriptSig", "txinwitness", "sequence"})
|
||||
public class RawInput {
|
||||
@JsonProperty("txid")
|
||||
private String txId;
|
||||
@JsonProperty("vout")
|
||||
private Integer vOut;
|
||||
private String coinbase;
|
||||
private SignatureScript scriptSig;
|
||||
@JsonProperty("txinwitness")
|
||||
private List<String> txInWitness;
|
||||
private String coinbase;
|
||||
private Long sequence;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": 190001,
|
||||
"subversion": "/Satoshi:0.19.0.1/",
|
||||
"protocolversion": 70015,
|
||||
"version": 210000,
|
||||
"subversion": "/Satoshi:0.21.0/",
|
||||
"protocolversion": 70016,
|
||||
"localservices": "000000000100040d",
|
||||
"localservicesnames": [
|
||||
"NETWORK",
|
||||
@ -14,6 +14,8 @@
|
||||
"timeoffset": -2,
|
||||
"networkactive": true,
|
||||
"connections": 9,
|
||||
"connections_in": 0,
|
||||
"connections_out": 9,
|
||||
"networks": [
|
||||
{
|
||||
"name": "ipv4",
|
||||
|
Loading…
Reference in New Issue
Block a user