summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjprupp <>2021-02-22 23:54:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2021-02-22 23:54:00 (GMT)
commit1c5331613f675822986b8d00fbc74e335aec1ee2 (patch)
tree8c9195c0f7758195e76c387bdd4edd47b02a51e4
parent042c483a93e39f6be228567aba2423a50ffe4d7c (diff)
version 0.47.20.47.2
-rw-r--r--CHANGELOG.md4
-rw-r--r--haskoin-store-data.cabal4
-rw-r--r--src/Haskoin/Store/Data.hs58
3 files changed, 35 insertions, 31 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5c103bd..89b9156 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
+## 0.47.2
+### Fixed
+- Fix serialization bug for health check.
+
## 0.47.1
### Fixed
- Fix serialization bugs for web data types.
diff --git a/haskoin-store-data.cabal b/haskoin-store-data.cabal
index f8f4e92..641e969 100644
--- a/haskoin-store-data.cabal
+++ b/haskoin-store-data.cabal
@@ -4,10 +4,10 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
--- hash: eee57844ddf308325bf17f93eb3f4c839c3b3f45c37030619e4d592e98ed5349
+-- hash: 26bfc2d99799fc52417601d4b2fa0ce25a5981df63ad79236d8567dba16d80cb
name: haskoin-store-data
-version: 0.47.1
+version: 0.47.2
synopsis: Data for Haskoin Store
description: Please see the README on GitHub at <https://github.com/haskoin/haskoin-store#readme>
category: Bitcoin, Finance, Network
diff --git a/src/Haskoin/Store/Data.hs b/src/Haskoin/Store/Data.hs
index 14cc56c..745b816 100644
--- a/src/Haskoin/Store/Data.hs
+++ b/src/Haskoin/Store/Data.hs
@@ -1598,21 +1598,21 @@ data BlockHealth =
BlockHealth
{ blockHealthHeaders :: !BlockHeight
, blockHealthBlocks :: !BlockHeight
- , blockHealthMaxDiff :: !Int
+ , blockHealthMaxDiff :: !Int32
}
deriving (Show, Eq, Generic, NFData)
instance Serial BlockHealth where
serialize h@BlockHealth{..} = do
serialize (isOK h)
- serialize blockHealthHeaders
- serialize blockHealthBlocks
- serialize blockHealthMaxDiff
+ putWord32be blockHealthHeaders
+ putWord32be blockHealthBlocks
+ putInt32be blockHealthMaxDiff
deserialize = do
k <- deserialize
- blockHealthHeaders <- deserialize
- blockHealthBlocks <- deserialize
- blockHealthMaxDiff <- deserialize
+ blockHealthHeaders <- getWord32be
+ blockHealthBlocks <- getWord32be
+ blockHealthMaxDiff <- getInt32be
let h = BlockHealth{..}
unless (k == isOK h) $ fail "Inconsistent health check"
return h
@@ -1654,20 +1654,20 @@ instance FromJSON BlockHealth where
data TimeHealth =
TimeHealth
- { timeHealthAge :: !Int
- , timeHealthMax :: !Int
+ { timeHealthAge :: !Int64
+ , timeHealthMax :: !Int64
}
deriving (Show, Eq, Generic, NFData)
instance Serial TimeHealth where
serialize h@TimeHealth{..} = do
serialize (isOK h)
- serialize timeHealthAge
- serialize timeHealthMax
+ putInt64be timeHealthAge
+ putInt64be timeHealthMax
deserialize = do
k <- deserialize
- timeHealthAge <- deserialize
- timeHealthMax <- deserialize
+ timeHealthAge <- getInt64be
+ timeHealthMax <- getInt64be
let t = TimeHealth{..}
unless (k == isOK t) $ fail "Inconsistent health check"
return t
@@ -1701,20 +1701,20 @@ instance FromJSON TimeHealth where
data CountHealth =
CountHealth
- { countHealthNum :: !Int
- , countHealthMin :: !Int
+ { countHealthNum :: !Int64
+ , countHealthMin :: !Int64
}
deriving (Show, Eq, Generic, NFData)
instance Serial CountHealth where
serialize h@CountHealth{..} = do
serialize (isOK h)
- serialize countHealthNum
- serialize countHealthMin
+ putInt64be countHealthNum
+ putInt64be countHealthMin
deserialize = do
k <- deserialize
- countHealthNum <- deserialize
- countHealthMin <- deserialize
+ countHealthNum <- getInt64be
+ countHealthMin <- getInt64be
let c = CountHealth{..}
unless (k == isOK c) $ fail "Inconsistent health check"
return c
@@ -1748,20 +1748,20 @@ instance FromJSON CountHealth where
data MaxHealth =
MaxHealth
- { maxHealthNum :: !Int
- , maxHealthMax :: !Int
+ { maxHealthNum :: !Int64
+ , maxHealthMax :: !Int64
}
deriving (Show, Eq, Generic, NFData)
instance Serial MaxHealth where
serialize h@MaxHealth {..} = do
serialize $ isOK h
- serialize maxHealthNum
- serialize maxHealthMax
+ putInt64be maxHealthNum
+ putInt64be maxHealthMax
deserialize = do
k <- deserialize
- maxHealthNum <- deserialize
- maxHealthMax <- deserialize
+ maxHealthNum <- getInt64be
+ maxHealthMax <- getInt64be
let h = MaxHealth{..}
unless (k == isOK h) $ fail "Inconsistent health check"
return h
@@ -1812,8 +1812,8 @@ instance Serial HealthCheck where
serialize healthLastTx
serialize healthPendingTxs
serialize healthPeers
- serialize healthNetwork
- serialize healthVersion
+ putLengthBytes ((TE.encodeUtf8 . T.pack) healthNetwork)
+ putLengthBytes ((TE.encodeUtf8 . T.pack) healthVersion)
deserialize = do
k <- deserialize
healthBlocks <- deserialize
@@ -1821,8 +1821,8 @@ instance Serial HealthCheck where
healthLastTx <- deserialize
healthPendingTxs <- deserialize
healthPeers <- deserialize
- healthNetwork <- deserialize
- healthVersion <- deserialize
+ healthNetwork <- T.unpack . TE.decodeUtf8 <$> getLengthBytes
+ healthVersion <- T.unpack . TE.decodeUtf8 <$> getLengthBytes
let h = HealthCheck {..}
unless (k == isOK h) $ fail "Inconsistent health check"
return h