Fix bcash EstimateFee after interface change in backend v0.19.1
parent
713f928a57
commit
8c471ed20d
|
@ -5,6 +5,7 @@ import (
|
|||
"blockbook/bchain/coins/btc"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"math/big"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/juju/errors"
|
||||
|
@ -161,3 +162,35 @@ func isErrBlockNotFound(err *bchain.RPCError) bool {
|
|||
return err.Message == "Block not found" ||
|
||||
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": "",
|
||||
"block_chain": {
|
||||
"parse": true,
|
||||
"subversion": "/Bitcoin ABC:0.17.1/",
|
||||
"subversion": "/Bitcoin ABC:0.19.1/",
|
||||
"address_format": "cashaddr",
|
||||
"mempool_workers": 8,
|
||||
"mempool_sub_workers": 2,
|
||||
|
|
Loading…
Reference in New Issue