Skip to content

Commit

Permalink
Dump header hash and slot no for events
Browse files Browse the repository at this point in the history
Co-authored-by: KtorZ <matthias.benkort@gmail.com>
  • Loading branch information
abailly and KtorZ committed Sep 21, 2023
1 parent 751454d commit 1ec2af8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cardano-node/src/Cardano/Node/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ import Cardano.Tracing.Config (TraceOptions (..), TraceSelection (..))

import qualified Ouroboros.Consensus.Config as Consensus
import Ouroboros.Consensus.Config.SupportsNode (ConfigSupportsNode (..))
import Ouroboros.Consensus.Ledger.Basics (AuxLedgerEvent, LedgerState)
import Ouroboros.Consensus.Ledger.Basics (LedgerEventHandler(..), LedgerState,
discardEvent)
import Ouroboros.Consensus.Ledger.Extended (ExtLedgerState)
import Ouroboros.Consensus.Node (NetworkP2PMode (..), RunNodeArgs (..),
StdRunNodeArgs (..))
import qualified Ouroboros.Consensus.Node as Node (getChainDB, run)
Expand Down Expand Up @@ -169,12 +171,12 @@ runNode cmdPc = do
SomeConsensusProtocol blk runP ->
handleNodeWithTracers
(case blk of
Api.CardanoBlockType -> \event -> do
putStrLn $ "New ledger event: " <> show (convertAuxLedgerEvent event)
Api.CardanoBlockType -> LedgerEventHandler $ \headerHash slotNo event -> do
putStrLn $ "New ledger event: " <> show headerHash <> " " <> show slotNo <> " " <> show (convertAuxLedgerEvent event)
Api.ByronBlockType{} ->
const $ pure ()
discardEvent
Api.ShelleyBlockType{} ->
const $ pure ()
discardEvent
)
cmdPc nc p networkMagic runP

Expand All @@ -200,7 +202,7 @@ handleNodeWithTracers
:: ( TraceConstraints blk
, Api.Protocol IO blk
)
=> (AuxLedgerEvent (LedgerState blk) -> IO ())
=> LedgerEventHandler IO (ExtLedgerState blk)
-> PartialNodeConfiguration
-> NodeConfiguration
-> SomeConsensusProtocol
Expand Down Expand Up @@ -337,7 +339,7 @@ handlePeersListSimple tr nodeKern = forever $ do

handleSimpleNode
:: forall blk p2p . Api.Protocol IO blk
=> (AuxLedgerEvent (LedgerState blk) -> IO ())
=> LedgerEventHandler IO (ExtLedgerState blk)
-> Api.ProtocolInfoArgs IO blk
-> NetworkP2PMode p2p
-> Tracers RemoteConnectionId LocalConnectionId blk p2p
Expand Down

0 comments on commit 1ec2af8

Please sign in to comment.