Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicated kaspaminer help output #2267

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

lemois-1337
Copy link

Even if kaspaminer isn't widely used anymore, it has some glitches with its command line argument processing. In Karlsen we still rely on the built-in miner and fixed it.

First issue: If ./kaspaminer -h is used, it shows the help twice and a Go trace at the end.

$ ./kaspaminer -h
Usage:
  kaspaminer [OPTIONS]

Application Options:
  -V, --version                   Display version information and exit
  -s, --rpcserver=                RPC server to connect to (default: localhost)
      --miningaddr=               Address to mine to
  -n, --numblocks=                Number of blocks to mine. If omitted, will mine until the process is interrupted.
      --mine-when-not-synced      Mine even if the node is not synced with the rest of the network.
      --profile=                  Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536
      --target-blocks-per-second= Sets a maximum block rate. 0 means no limit (The default one is 2 * target network block rate)
      --testnet                   Use the test network
      --simnet                    Use the simulation test network
      --devnet                    Use the development test network
      --override-dag-params-file= Overrides DAG params (allowed only on devnet)

Help Options:
  -h, --help                      Show this help message

Error parsing command-line arguments: Usage:
  kaspaminer [OPTIONS]

Application Options:
  -V, --version                   Display version information and exit
  -s, --rpcserver=                RPC server to connect to (default: localhost)
      --miningaddr=               Address to mine to
  -n, --numblocks=                Number of blocks to mine. If omitted, will mine until the process is interrupted.
      --mine-when-not-synced      Mine even if the node is not synced with the rest of the network.
      --profile=                  Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536
      --target-blocks-per-second= Sets a maximum block rate. 0 means no limit (The default one is 2 * target network block rate)
      --testnet                   Use the test network
      --simnet                    Use the simulation test network
      --devnet                    Use the development test network
      --override-dag-params-file= Overrides DAG params (allowed only on devnet)

Help Options:
  -h, --help                      Show this help message

main.main
	/home/lemois/kaspad/cmd/kaspaminer/main.go:26
runtime.main
	/usr/lib/go/src/runtime/proc.go:271
runtime.goexit
	/usr/lib/go/src/runtime/asm_amd64.s:1695

Second issue: If ./kaspaminer is executed without any argument, it shows correct error message but still a Go trace.

$ ./kaspaminer 
Error parsing command-line arguments: --miningaddr is required
main.main
	/home/lemois/kaspad/cmd/kaspaminer/main.go:26
runtime.main
	/usr/lib/go/src/runtime/proc.go:271
runtime.goexit
	/usr/lib/go/src/runtime/asm_amd64.s:1695

Both issues are fixed with this pull request. For reference, downstream issues: karlsen-network#34 and karlsen-network#38

@lemois-1337 lemois-1337 changed the base branch from master to dev February 18, 2024 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant