From 2adfcd211da7a75dcdfa7d7917e2dfa40e332f3b Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Fri, 23 Sep 2022 17:48:05 -0700 Subject: [PATCH] rpcclient: add -quiet option to the lbcdblocknotify example --- rpcclient/examples/lbcdblocknotify/README.md | 2 ++ rpcclient/examples/lbcdblocknotify/main.go | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rpcclient/examples/lbcdblocknotify/README.md b/rpcclient/examples/lbcdblocknotify/README.md index 45ab3b29..55fc19b0 100644 --- a/rpcclient/examples/lbcdblocknotify/README.md +++ b/rpcclient/examples/lbcdblocknotify/README.md @@ -29,6 +29,8 @@ $ go run . -h Stratum server (default "lbrypool.net:3334") -stratumpass string Stratum server password (default "password") + -quiet + Do not print logs ``` Start the program: diff --git a/rpcclient/examples/lbcdblocknotify/main.go b/rpcclient/examples/lbcdblocknotify/main.go index af538642..9b672a59 100644 --- a/rpcclient/examples/lbcdblocknotify/main.go +++ b/rpcclient/examples/lbcdblocknotify/main.go @@ -30,13 +30,16 @@ var ( rpcpass = flag.String("rpcpass", "rpcpass", "LBCD RPC password") notls = flag.Bool("notls", false, "Connect to LBCD with TLS disabled") run = flag.String("run", "", "Run custom shell command") + quiet = flag.Bool("quiet", false, "Do not print logs") ) func onFilteredBlockConnected(height int32, header *wire.BlockHeader, txns []*lbcutil.Tx) { blockHash := header.BlockHash().String() - log.Printf("Block connected: %v (%d) %v", blockHash, height, header.Timestamp) + if !*quiet { + log.Printf("Block connected: %v (%d) %v", blockHash, height, header.Timestamp) + } if cmd := *run; len(cmd) != 0 { cmd = strings.ReplaceAll(cmd, "%s", blockHash)