Skip to content

Conversation

@bznein
Copy link
Collaborator

@bznein bznein commented Oct 16, 2025

Before asking for reviews, here is a check list of the most common things you might need to consider:

  • updating the Changelog
  • writing unit tests
  • checking if your changes affect other coins or tokens in unintended ways
  • testing on multiple environments (Qt, Android, ...)
  • having an AI review your changes

// DeviceInfos returns the list of connected USB devices. If the simulator is running, it returns only
// the simulator device info.
// Otherwise, it returns the actual connected USB devices.
func DeviceInfos() []usb.DeviceInfo {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would undo this and put it back into servewallet/main.go. It's only used there, and to me it makes more sense that the caller makes the distinction, and not the bitbox02/simulator package, similar like you do it in qt's server.go

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The "ugly" part of this, is that there is duplication of code, as now servewallet/main's DeviceInfos is basically duplicated in server.go but I think we can live with it.

func deviceInfos() []usb.DeviceInfo {
testDeviceInfo := simulator.TestDeviceInfo()
if testDeviceInfo != nil {
return []usb.DeviceInfo{*testDeviceInfo}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why dereference? can just keep testDeviceInfo by ref right? Same in servewallet/main.go

}

if simulator && !globalBackend.Testing() {
log.Panic("Simulator can only be used in testnet mode")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not visible on the command line. Maybe also write to stderr so users can see what went wrong.

Thinking some more about this, maybe it's most ergonomical if -simulator just implied -testnet? Then you could remove the simulator flag here and this check here and just pass testnet=true if simulator is set.

Wdyt?

log.WithField("args", os.Args).Info("Started Qt application")
testnet := flag.Bool("testnet", false, "activate testnets")
simulatorPort := flag.Int("simulatorPort", 15423, "port for the BitBox02 simulator")
useSimulator := flag.Bool("simulator", false, "use the BitBox02 simulator")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mention that it implies testnet (if you make this change), or mention that testnet is required if you prefer to keep the testnet check

Copy link
Contributor

@benma benma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@bznein bznein merged commit 3e4fc1f into BitBoxSwiss:master Oct 22, 2025
13 checks passed
@bznein bznein deleted the simulatorQT branch October 22, 2025 08:15
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.

2 participants