Skip to content

Commit

Permalink
Merge pull request #888 from IntersectMBO/jordan/bump-cardano-ping-0.4
Browse files Browse the repository at this point in the history
Add support for fetching tip through cardano-ping
  • Loading branch information
Jimbo4350 committed Sep 9, 2024
2 parents e64120d + d1d4dde commit 551d9b9
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository cardano-haskell-packages
-- you need to run if you change them
index-state:
, hackage.haskell.org 2024-08-08T19:27:29Z
, cardano-haskell-packages 2024-09-05T16:30:09Z
, cardano-haskell-packages 2024-09-09T11:32:44Z

packages:
cardano-cli
Expand Down Expand Up @@ -57,3 +57,4 @@ write-ghc-environment-files: always
-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

2 changes: 1 addition & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ library
cardano-ledger-byron >=1.0.1.0,
cardano-ledger-core,
cardano-ledger-shelley,
cardano-ping ^>=0.2.0.13,
cardano-ping ^>=0.4,
cardano-prelude,
cardano-slotting ^>=0.2.0.0,
cardano-strict-containers ^>=0.1,
Expand Down
1 change: 1 addition & 0 deletions cardano-cli/src/Cardano/CLI/Commands/Ping.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ data PingCmd = PingCmd
, pingCmdJson :: !Bool
, pingCmdQuiet :: !Bool
, pingOptsHandshakeQuery :: !Bool
, pingOptsGetTip :: !Bool
}
deriving (Eq, Show)
7 changes: 7 additions & 0 deletions cardano-cli/src/Cardano/CLI/Options/Ping.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ pPing =
"Query the supported protocol versions using the handshake protocol and terminate the connection."
]
)
<*> ( Opt.switch $
mconcat
[ Opt.long "tip"
, Opt.short 't'
, Opt.help "Request tip then exit."
]
)
6 changes: 5 additions & 1 deletion cardano-cli/src/Cardano/CLI/Run/Ping.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pingClient stdout stderr cmd = CNP.pingClient stdout stderr opts
, CNP.pingOptsPort = pingCmdPort cmd
, CNP.pingOptsMagic = pingCmdMagic cmd
, CNP.pingOptsHandshakeQuery = pingOptsHandshakeQuery cmd
, CNP.pingOptsGetTip = pingOptsGetTip cmd
}

runPingCmd :: PingCmd -> ExceptT PingClientCmdError IO ()
Expand All @@ -80,7 +81,10 @@ runPingCmd options = do
return ([addr], CNP.supportedNodeToClientVersions $ pingCmdMagic options)

-- Logger async thread handle
laid <- liftIO . async $ CNP.logger msgQueue (pingCmdJson options) (pingOptsHandshakeQuery options)
laid <-
liftIO . async $
CNP.logger msgQueue (pingCmdJson options) (pingOptsHandshakeQuery options) (pingOptsGetTip options)

-- Ping client thread handles
caids <-
forM addresses $
Expand Down
1 change: 1 addition & 0 deletions cardano-cli/test/cardano-cli-golden/files/golden/help.cli
Original file line number Diff line number Diff line change
Expand Up @@ -12529,6 +12529,7 @@ Usage: cardano-cli ping [-c|--count COUNT]
[-j|--json]
[-q|--quiet]
[-Q|--query-versions]
[-t|--tip]

Ping a cardano node either using node-to-node or node-to-client protocol. It negotiates a handshake and keeps sending keep alive messages.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Usage: cardano-cli ping [-c|--count COUNT]
[-j|--json]
[-q|--quiet]
[-Q|--query-versions]
[-t|--tip]

Ping a cardano node either using node-to-node or node-to-client protocol. It negotiates a handshake and keeps sending keep alive messages.

Expand All @@ -20,4 +21,5 @@ Available options:
-q,--quiet Quiet flag, CSV/JSON only output
-Q,--query-versions Query the supported protocol versions using the
handshake protocol and terminate the connection.
-t,--tip Request tip then exit.
-h,--help Show this help text
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 551d9b9

Please sign in to comment.