From d3061525654a86b81673539727290a1775c1c313 Mon Sep 17 00:00:00 2001 From: Dimitrios Siganos Date: Wed, 17 Apr 2024 19:14:16 +0900 Subject: [PATCH 1/2] Print the rpc listening port on node start-up It is a useful piece of information --- nano/rpc/rpc.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/nano/rpc/rpc.cpp b/nano/rpc/rpc.cpp index c2cae1e3e9..5b5d84ecde 100644 --- a/nano/rpc/rpc.cpp +++ b/nano/rpc/rpc.cpp @@ -50,6 +50,7 @@ void nano::rpc::start () logger.critical (nano::log::type::rpc, "Error while binding for RPC on port: {} ({})", endpoint.port (), ec.message ()); throw std::runtime_error (ec.message ()); } + logger.info (nano::log::type::rpc, "RPC listening address: {}", fmt::streamed (acceptor.local_endpoint ())); acceptor.listen (); accept (); } From 2b5006f5211bda1dc95e1f6c88c41d4b4f77b4b4 Mon Sep 17 00:00:00 2001 From: Dimitrios Siganos Date: Wed, 17 Apr 2024 19:32:46 +0900 Subject: [PATCH 2/2] Introduce a systest case for rpc stop command --- systest/rpc_stop.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 systest/rpc_stop.sh diff --git a/systest/rpc_stop.sh b/systest/rpc_stop.sh new file mode 100755 index 0000000000..bee54b88ad --- /dev/null +++ b/systest/rpc_stop.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -eux + +DATADIR=$(mktemp -d) + +# Start the node in daemon mode in the background +$NANO_NODE_EXE --daemon --network dev --data_path $DATADIR --config rpc.enable=true --rpcconfig enable_control=true & +NODE_PID=$! + +# Allow some time for the node to start up completely +sleep 10 + +# Send the stop rpc command +curl -g -d '{ "action": "stop" }' '[::1]:45000' + +# Check if the process has stopped using a timeout to avoid infinite waiting +if wait $NODE_PID; then + echo "Node stopped successfully" +else + echo "Node did not stop as expected" + exit 1 +fi