rpcclient: add -quiet option to the lbcdblocknotify example

This commit is contained in:
Roy Lee 2022-09-23 17:48:05 -07:00
parent 81ec217899
commit 2adfcd211d
2 changed files with 6 additions and 1 deletions

View file

@ -29,6 +29,8 @@ $ go run . -h
Stratum server (default "lbrypool.net:3334") Stratum server (default "lbrypool.net:3334")
-stratumpass string -stratumpass string
Stratum server password (default "password") Stratum server password (default "password")
-quiet
Do not print logs
``` ```
Start the program: Start the program:

View file

@ -30,13 +30,16 @@ var (
rpcpass = flag.String("rpcpass", "rpcpass", "LBCD RPC password") rpcpass = flag.String("rpcpass", "rpcpass", "LBCD RPC password")
notls = flag.Bool("notls", false, "Connect to LBCD with TLS disabled") notls = flag.Bool("notls", false, "Connect to LBCD with TLS disabled")
run = flag.String("run", "", "Run custom shell command") 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) { func onFilteredBlockConnected(height int32, header *wire.BlockHeader, txns []*lbcutil.Tx) {
blockHash := header.BlockHash().String() 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 { if cmd := *run; len(cmd) != 0 {
cmd = strings.ReplaceAll(cmd, "%s", blockHash) cmd = strings.ReplaceAll(cmd, "%s", blockHash)