rpcclient: add -quiet option to the lbcdblocknotify example
This commit is contained in:
parent
81ec217899
commit
2adfcd211d
2 changed files with 6 additions and 1 deletions
|
@ -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:
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
|
if !*quiet {
|
||||||
log.Printf("Block connected: %v (%d) %v", blockHash, height, header.Timestamp)
|
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)
|
||||||
|
|
Loading…
Reference in a new issue