From f696d49c494caf99ba6280ab55f55d4711907408 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 15 Aug 2018 21:02:33 -0700 Subject: [PATCH] btcjson/chainsvrresults: use int64 for verbose getblock[header] confs This commit modifies the parsed fields in GetBlockVerbose and GetBlockHeaderVerbose from a uint64 to an int64. bitcoind will return -1 if the requested block is not in the main chain, which causes a panic when trying to serialize into a uint. --- btcjson/chainsvrresults.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/btcjson/chainsvrresults.go b/btcjson/chainsvrresults.go index 24d6cf7c..30c6369a 100644 --- a/btcjson/chainsvrresults.go +++ b/btcjson/chainsvrresults.go @@ -11,7 +11,7 @@ import "encoding/json" // returns a hex-encoded string. type GetBlockHeaderVerboseResult struct { Hash string `json:"hash"` - Confirmations uint64 `json:"confirmations"` + Confirmations int64 `json:"confirmations"` Height int32 `json:"height"` Version int32 `json:"version"` VersionHex string `json:"versionHex"` @@ -29,7 +29,7 @@ type GetBlockHeaderVerboseResult struct { // hex-encoded string. type GetBlockVerboseResult struct { Hash string `json:"hash"` - Confirmations uint64 `json:"confirmations"` + Confirmations int64 `json:"confirmations"` StrippedSize int32 `json:"strippedsize"` Size int32 `json:"size"` Weight int32 `json:"weight"`