Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions api/firmware/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package firmware

import (
"bytes"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -12,7 +11,7 @@ import (
func TestSimulatorBackups(t *testing.T) {
const seedLen = 32
const testName = "test wallet name"
testSimulatorsAfterPairing(t, func(t *testing.T, device *Device, stdOut *bytes.Buffer) {
testSimulatorsAfterPairing(t, func(t *testing.T, device *Device, stdOut *simulatorStdout) {
t.Helper()
require.NoError(t, device.SetDeviceName(testName))

Expand Down
3 changes: 1 addition & 2 deletions api/firmware/bip85_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package firmware

import (
"bytes"
"encoding/hex"
"testing"

Expand All @@ -16,7 +15,7 @@ func TestSimulatorBIP85AppBip39(t *testing.T) {
}

func TestSimulatorBIP85AppLN(t *testing.T) {
testInitializedSimulators(t, func(t *testing.T, device *Device, stdOut *bytes.Buffer) {
testInitializedSimulators(t, func(t *testing.T, device *Device, stdOut *simulatorStdout) {
t.Helper()
entropy, err := device.BIP85AppLN()
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions api/firmware/bitboxsync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func TestBitBoxSyncHostSideValidation(t *testing.T) {
}

func TestSimulatorBitBoxSyncIdentity(t *testing.T) {
testInitializedSimulators(t, func(t *testing.T, device *Device, stdOut *bytes.Buffer) {
testInitializedSimulators(t, func(t *testing.T, device *Device, stdOut *simulatorStdout) {
t.Helper()
if !device.Version().AtLeast(bitBoxSyncMinVersion) {
identity, err := device.BitBoxSyncIdentity()
Expand All @@ -214,7 +214,7 @@ func TestSimulatorBitBoxSyncIdentity(t *testing.T) {
}

func TestSimulatorBitBoxSyncSignaturesAndUnwrap(t *testing.T) {
testInitializedSimulators(t, func(t *testing.T, device *Device, stdOut *bytes.Buffer) {
testInitializedSimulators(t, func(t *testing.T, device *Device, stdOut *simulatorStdout) {
t.Helper()
challenge := bytes.Repeat([]byte{0x42}, bitBoxSyncChallengeLength)
namespaceID := bytes.Repeat([]byte{0x11}, bitBoxSyncNamespaceIDLen)
Expand Down
10 changes: 8 additions & 2 deletions api/firmware/btc.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,14 @@ func (device *Device) nonAtomicNestedQueryBtcSign(request *messages.BTCRequest)
}

func isTaproot(sc *messages.BTCScriptConfigWithKeypath) bool {
simpleTypeConfig, ok := sc.ScriptConfig.Config.(*messages.BTCScriptConfig_SimpleType_)
return ok && simpleTypeConfig.SimpleType == messages.BTCScriptConfig_P2TR
switch config := sc.ScriptConfig.Config.(type) {
case *messages.BTCScriptConfig_SimpleType_:
return config.SimpleType == messages.BTCScriptConfig_P2TR
case *messages.BTCScriptConfig_Policy_:
return strings.HasPrefix(config.Policy.GetPolicy(), "tr(")
default:
return false
}
}

// BTCSignNeedsPrevTxs returns true if the PrevTx field in BTCTxInput needs to be populated before
Expand Down
Loading
Loading