diff --git a/cabal.project b/cabal.project index 594072e06..e50bba650 100644 --- a/cabal.project +++ b/cabal.project @@ -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 @@ -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. + diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 08f1f7a4c..0437ce8c7 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -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, diff --git a/cardano-cli/src/Cardano/CLI/Commands/Ping.hs b/cardano-cli/src/Cardano/CLI/Commands/Ping.hs index 11e07f7e7..b45bb8723 100644 --- a/cardano-cli/src/Cardano/CLI/Commands/Ping.hs +++ b/cardano-cli/src/Cardano/CLI/Commands/Ping.hs @@ -19,5 +19,6 @@ data PingCmd = PingCmd , pingCmdJson :: !Bool , pingCmdQuiet :: !Bool , pingOptsHandshakeQuery :: !Bool + , pingOptsGetTip :: !Bool } deriving (Eq, Show) diff --git a/cardano-cli/src/Cardano/CLI/Options/Ping.hs b/cardano-cli/src/Cardano/CLI/Options/Ping.hs index f07570b13..951e9af65 100644 --- a/cardano-cli/src/Cardano/CLI/Options/Ping.hs +++ b/cardano-cli/src/Cardano/CLI/Options/Ping.hs @@ -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." + ] + ) diff --git a/cardano-cli/src/Cardano/CLI/Run/Ping.hs b/cardano-cli/src/Cardano/CLI/Run/Ping.hs index dd6aa5fb7..2cbaaa6c3 100644 --- a/cardano-cli/src/Cardano/CLI/Run/Ping.hs +++ b/cardano-cli/src/Cardano/CLI/Run/Ping.hs @@ -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 () @@ -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 $ diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index c85e2a761..d067ad7cd 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -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. diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/ping.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/ping.cli index 1c59c187d..c919aa1ed 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/ping.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/ping.cli @@ -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. @@ -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 diff --git a/flake.lock b/flake.lock index 42d5ad871..e6a76a06b 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1725556271, - "narHash": "sha256-+cwhAlF4zGfWC3UTSppYOwZ8SRcAfWU3WweenyvYgLA=", + "lastModified": 1725882485, + "narHash": "sha256-lL70EjKqXpTazTu7VkoGzQOEvEmdpa9/yD3W9x4t+KU=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "c9c0d9f9c76ea1e18d8fb8b744c52bfc39b058c8", + "rev": "dd0b250a0c215e0e617739e3928deb7e7c8a2f79", "type": "github" }, "original": {