Skip to content

Commit

Permalink
Merge branch 'master' into chessai/fold-in-chainweb-storage
Browse files Browse the repository at this point in the history
Change-Id: Ie3dc6fe90a04f9ac15c41b13f1cb766e797f9d51
  • Loading branch information
chessai committed Jan 14, 2025
2 parents a4c9654 + d7b0fae commit d39b7a5
Show file tree
Hide file tree
Showing 10 changed files with 1,568 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/kadena-io/pact-5.git
tag: 87c2d748ce18331cd8e0ad45af11c93b64684323
--sha256: 1w0rmid741c6amvcgcla21yvliilp09aixcr9rzhvj4gc6mfbflc
tag: ebb66271ecce7cac1a7901a15658ad1b8233743a
--sha256: 1c362q6jpiq7gndypxci5bdpcm7hxbpg90fim4c977pxphsbiv1k

source-repository-package
type: git
Expand Down
2 changes: 2 additions & 0 deletions chainweb.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ test-suite chainweb-tests
Chainweb.Test.Pact5.RemotePactTest
Chainweb.Test.Pact5.SPVTest
Chainweb.Test.Pact5.TransactionExecTest
Chainweb.Test.Pact5.TransactionTests
Chainweb.Test.RestAPI
Chainweb.Test.Roundtrips
Chainweb.Test.SPV
Expand Down Expand Up @@ -725,6 +726,7 @@ test-suite chainweb-tests
, pact-tng
, pact-tng:pact-request-api
, pact-tng:test-utils
, pact-tng:pact-repl
, patience >= 0.3
, prettyprinter
, property-matchers ^>= 0.4
Expand Down
6 changes: 6 additions & 0 deletions node/src/ChainwebNode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import Chainweb.Chainweb.CutResources
import Chainweb.Counter
import Chainweb.Cut.CutHashes
import Chainweb.CutDB
import Chainweb.Difficulty
import Chainweb.Logger
import Chainweb.Logging.Config
import Chainweb.Logging.Miner
Expand Down Expand Up @@ -223,6 +224,7 @@ data BlockUpdate = BlockUpdate
{ _blockUpdateBlockHeader :: !(ObjectEncoded BlockHeader)
, _blockUpdateOrphaned :: !Bool
, _blockUpdateTxCount :: !Int
, _blockUpdateDifficultyDouble :: !Double
}
deriving (Show, Eq, Ord, Generic, NFData)

Expand All @@ -231,10 +233,12 @@ instance ToJSON BlockUpdate where
$ "header" .= _blockUpdateBlockHeader o
<> "orphaned" .= _blockUpdateOrphaned o
<> "txCount" .= _blockUpdateTxCount o
<> "difficultyDouble" .= _blockUpdateDifficultyDouble o
toJSON o = object
[ "header" .= _blockUpdateBlockHeader o
, "orphaned" .= _blockUpdateOrphaned o
, "txCount" .= _blockUpdateTxCount o
, "difficultyDouble" .= _blockUpdateDifficultyDouble o
]

{-# INLINE toEncoding #-}
Expand All @@ -261,10 +265,12 @@ runBlockUpdateMonitor logger db = L.withLoggerLabel ("component", "block-update-
<$> pure (ObjectEncoded bh) -- _blockUpdateBlockHeader
<*> pure False -- _blockUpdateOrphaned
<*> txCount bh -- _blockUpdateTxCount
<*> pure (difficultyToDouble (targetToDifficulty (view blockTarget bh))) -- _blockUpdateDifficultyDouble
toUpdate (Left bh) = BlockUpdate
<$> pure (ObjectEncoded bh) -- _blockUpdateBlockHeader
<*> pure True -- _blockUpdateOrphaned
<*> ((0 -) <$> txCount bh) -- _blockUpdateTxCount
<*> pure (difficultyToDouble (targetToDifficulty (view blockTarget bh))) -- _blockUpdateDifficultyDouble

-- type CutLog = HM.HashMap ChainId (ObjectEncoded BlockHeader)

Expand Down
Loading

0 comments on commit d39b7a5

Please sign in to comment.