mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +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) {
|
||||
try {
|
||||
return getBitcoindService().getTransaction(txid, false).get("hex").toString();
|
||||
return getBitcoindService().getTransaction(txid, true, false).get("hex").toString();
|
||||
} catch(JsonRpcException e) {
|
||||
return getBitcoindService().getRawTransaction(txid, false).toString();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
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.JsonRpcOptional;
|
||||
import com.github.arteam.simplejsonrpc.core.annotation.JsonRpcParam;
|
||||
|
@ -9,6 +11,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
@JsonRpcService
|
||||
@JsonRpcParams(ParamsType.ARRAY)
|
||||
public interface BitcoindClientService {
|
||||
@JsonRpcMethod("uptime")
|
||||
long uptime();
|
||||
|
@ -44,7 +47,7 @@ public interface BitcoindClientService {
|
|||
Object getRawTransaction(@JsonRpcParam("txid") String txid, @JsonRpcParam("verbose") boolean verbose);
|
||||
|
||||
@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")
|
||||
MempoolEntry getMempoolEntry(@JsonRpcParam("txid") String txid);
|
||||
|
|
|
@ -150,7 +150,7 @@ public class ElectrumServerService {
|
|||
return bitcoindClient.getBitcoindService().getRawTransaction(tx_hash, true);
|
||||
} catch(JsonRpcException e) {
|
||||
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");
|
||||
if(decoded instanceof Map<?, ?>) {
|
||||
Map<String, Object> decodedMap = (Map<String, Object>)decoded;
|
||||
|
@ -172,7 +172,7 @@ public class ElectrumServerService {
|
|||
}
|
||||
} else {
|
||||
try {
|
||||
return bitcoindClient.getBitcoindService().getTransaction(tx_hash, false).get("hex");
|
||||
return bitcoindClient.getBitcoindService().getTransaction(tx_hash, true, false).get("hex");
|
||||
} catch(JsonRpcException e) {
|
||||
try {
|
||||
return bitcoindClient.getBitcoindService().getRawTransaction(tx_hash, false);
|
||||
|
|
Loading…
Reference in a new issue