mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 13:16:44 +00:00
cormorant: switch bitcoind client from named to array parameters to support btc-rpc-proxy
This commit is contained in:
parent
fb3b674b65
commit
a66b36c59c
3 changed files with 7 additions and 4 deletions
|
@ -444,7 +444,7 @@ public class BitcoindClient {
|
||||||
|
|
||||||
private String getTransaction(String txid) {
|
private String getTransaction(String txid) {
|
||||||
try {
|
try {
|
||||||
return getBitcoindService().getTransaction(txid, false).get("hex").toString();
|
return getBitcoindService().getTransaction(txid, true, false).get("hex").toString();
|
||||||
} catch(JsonRpcException e) {
|
} catch(JsonRpcException e) {
|
||||||
return getBitcoindService().getRawTransaction(txid, false).toString();
|
return getBitcoindService().getRawTransaction(txid, false).toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.sparrowwallet.sparrow.net.cormorant.bitcoind;
|
package com.sparrowwallet.sparrow.net.cormorant.bitcoind;
|
||||||
|
|
||||||
|
import com.github.arteam.simplejsonrpc.client.JsonRpcParams;
|
||||||
|
import com.github.arteam.simplejsonrpc.client.ParamsType;
|
||||||
import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcMethod;
|
import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcMethod;
|
||||||
import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcOptional;
|
import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcOptional;
|
||||||
import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcParam;
|
import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcParam;
|
||||||
|
@ -9,6 +11,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@JsonRpcService
|
@JsonRpcService
|
||||||
|
@JsonRpcParams(ParamsType.ARRAY)
|
||||||
public interface BitcoindClientService {
|
public interface BitcoindClientService {
|
||||||
@JsonRpcMethod("uptime")
|
@JsonRpcMethod("uptime")
|
||||||
long uptime();
|
long uptime();
|
||||||
|
@ -44,7 +47,7 @@ public interface BitcoindClientService {
|
||||||
Object getRawTransaction(@JsonRpcParam("txid") String txid, @JsonRpcParam("verbose") boolean verbose);
|
Object getRawTransaction(@JsonRpcParam("txid") String txid, @JsonRpcParam("verbose") boolean verbose);
|
||||||
|
|
||||||
@JsonRpcMethod("gettransaction")
|
@JsonRpcMethod("gettransaction")
|
||||||
Map<String, Object> getTransaction(@JsonRpcParam("txid") String txid, @JsonRpcParam("verbose") boolean verbose);
|
Map<String, Object> getTransaction(@JsonRpcParam("txid") String txid, @JsonRpcParam("include_watchonly") boolean includeWatchOnly, @JsonRpcParam("verbose") boolean verbose);
|
||||||
|
|
||||||
@JsonRpcMethod("getmempoolentry")
|
@JsonRpcMethod("getmempoolentry")
|
||||||
MempoolEntry getMempoolEntry(@JsonRpcParam("txid") String txid);
|
MempoolEntry getMempoolEntry(@JsonRpcParam("txid") String txid);
|
||||||
|
|
|
@ -150,7 +150,7 @@ public class ElectrumServerService {
|
||||||
return bitcoindClient.getBitcoindService().getRawTransaction(tx_hash, true);
|
return bitcoindClient.getBitcoindService().getRawTransaction(tx_hash, true);
|
||||||
} catch(JsonRpcException e) {
|
} catch(JsonRpcException e) {
|
||||||
try {
|
try {
|
||||||
Map<String, Object> txInfo = bitcoindClient.getBitcoindService().getTransaction(tx_hash, true);
|
Map<String, Object> txInfo = bitcoindClient.getBitcoindService().getTransaction(tx_hash, true, true);
|
||||||
Object decoded = txInfo.get("decoded");
|
Object decoded = txInfo.get("decoded");
|
||||||
if(decoded instanceof Map<?, ?>) {
|
if(decoded instanceof Map<?, ?>) {
|
||||||
Map<String, Object> decodedMap = (Map<String, Object>)decoded;
|
Map<String, Object> decodedMap = (Map<String, Object>)decoded;
|
||||||
|
@ -172,7 +172,7 @@ public class ElectrumServerService {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
return bitcoindClient.getBitcoindService().getTransaction(tx_hash, false).get("hex");
|
return bitcoindClient.getBitcoindService().getTransaction(tx_hash, true, false).get("hex");
|
||||||
} catch(JsonRpcException e) {
|
} catch(JsonRpcException e) {
|
||||||
try {
|
try {
|
||||||
return bitcoindClient.getBitcoindService().getRawTransaction(tx_hash, false);
|
return bitcoindClient.getBitcoindService().getRawTransaction(tx_hash, false);
|
||||||
|
|
Loading…
Reference in a new issue