Fix bcash EstimateFee after interface change in backend v0.19.1
This commit is contained in:
parent
57ce874208
commit
ee4ecc2bb0
@ -5,6 +5,7 @@ import (
|
|||||||
"blockbook/bchain/coins/btc"
|
"blockbook/bchain/coins/btc"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"math/big"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/juju/errors"
|
"github.com/juju/errors"
|
||||||
@ -162,3 +163,35 @@ func isErrBlockNotFound(err *bchain.RPCError) bool {
|
|||||||
return err.Message == "Block not found" ||
|
return err.Message == "Block not found" ||
|
||||||
err.Message == "Block height out of range"
|
err.Message == "Block height out of range"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EstimateFee returns fee estimation
|
||||||
|
func (b *BCashRPC) EstimateFee(blocks int) (big.Int, error) {
|
||||||
|
// from version BitcoinABC version 0.19.1 EstimateFee does not support parameter Blocks
|
||||||
|
if b.ChainConfig.CoinShortcut == "BCHSV" {
|
||||||
|
return b.BitcoinRPC.EstimateFee(blocks)
|
||||||
|
}
|
||||||
|
|
||||||
|
glog.V(1).Info("rpc: estimatefee ", blocks)
|
||||||
|
|
||||||
|
res := btc.ResEstimateFee{}
|
||||||
|
req := struct {
|
||||||
|
Method string `json:"method"`
|
||||||
|
}{
|
||||||
|
Method: "estimatefee",
|
||||||
|
}
|
||||||
|
|
||||||
|
err := b.Call(&req, &res)
|
||||||
|
|
||||||
|
var r big.Int
|
||||||
|
if err != nil {
|
||||||
|
return r, err
|
||||||
|
}
|
||||||
|
if res.Error != nil {
|
||||||
|
return r, res.Error
|
||||||
|
}
|
||||||
|
r, err = b.Parser.AmountToBigInt(res.Result)
|
||||||
|
if err != nil {
|
||||||
|
return r, err
|
||||||
|
}
|
||||||
|
return r, nil
|
||||||
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
"additional_params": "",
|
"additional_params": "",
|
||||||
"block_chain": {
|
"block_chain": {
|
||||||
"parse": true,
|
"parse": true,
|
||||||
"subversion": "/Bitcoin ABC:0.17.1/",
|
"subversion": "/Bitcoin ABC:0.19.1/",
|
||||||
"address_format": "cashaddr",
|
"address_format": "cashaddr",
|
||||||
"mempool_workers": 8,
|
"mempool_workers": 8,
|
||||||
"mempool_sub_workers": 2,
|
"mempool_sub_workers": 2,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user