Return consensusBranchId
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func GetSaplingInfo(rpcClient *rpcclient.Client) (int, string, error) {
|
||||
func GetSaplingInfo(rpcClient *rpcclient.Client) (int, string, string, error) {
|
||||
result, rpcErr := rpcClient.RawRequest("getblockchaininfo", make([]json.RawMessage, 0))
|
||||
|
||||
var err error
|
||||
@@ -25,15 +25,15 @@ func GetSaplingInfo(rpcClient *rpcclient.Client) (int, string, error) {
|
||||
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
||||
//Check to see if we are requesting a height the zcashd doesn't have yet
|
||||
if err == nil && errCode == -8 {
|
||||
return -1, "", nil
|
||||
return -1, "", "", nil
|
||||
}
|
||||
return -1, "", errors.Wrap(rpcErr, "error requesting block")
|
||||
return -1, "", "", errors.Wrap(rpcErr, "error requesting block")
|
||||
}
|
||||
|
||||
var f interface{}
|
||||
err = json.Unmarshal(result, &f)
|
||||
if err != nil {
|
||||
return -1, "", errors.Wrap(err, "error reading JSON response")
|
||||
return -1, "", "", errors.Wrap(err, "error reading JSON response")
|
||||
}
|
||||
|
||||
chainName := f.(map[string]interface{})["chain"].(string)
|
||||
@@ -42,7 +42,10 @@ func GetSaplingInfo(rpcClient *rpcclient.Client) (int, string, error) {
|
||||
saplingJSON := upgradeJSON.(map[string]interface{})["76b809bb"] // Sapling ID
|
||||
saplingHeight := saplingJSON.(map[string]interface{})["activationheight"].(float64)
|
||||
|
||||
return int(saplingHeight), chainName, nil
|
||||
consensus := f.(map[string]interface{})["consensus"]
|
||||
branchID := consensus.(map[string]interface{})["nextblock"].(string)
|
||||
|
||||
return int(saplingHeight), chainName, branchID, nil
|
||||
}
|
||||
|
||||
func getBlockFromRPC(rpcClient *rpcclient.Client, height int) (*walletrpc.CompactBlock, error) {
|
||||
|
||||
Reference in New Issue
Block a user