Skip to content

Commit

Permalink
rpcclient: add -quiet option to the lbcdblocknotify example
Browse files Browse the repository at this point in the history
  • Loading branch information
roylee17 committed Sep 24, 2022
1 parent 81ec217 commit 2adfcd2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rpcclient/examples/lbcdblocknotify/README.md
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion rpcclient/examples/lbcdblocknotify/main.go
Expand Up @@ -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)
Expand Down

0 comments on commit 2adfcd2

Please sign in to comment.