Skip to content

Commit

Permalink
chore(connect): default to nversion=1 again
Browse files Browse the repository at this point in the history
  • Loading branch information
marekrjpolak authored and mroz22 committed Nov 28, 2024
1 parent 7ed5157 commit ee1c07f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/connect/e2e/tests/device/unlockPath.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('TrezorConnect.unlockPath', () => {

expect(unlockedSignTx.payload).toMatchObject({
serializedTx:
'020000000001010ab6ad3ba09261cfb4fa1d3680cb19332a8fe4d9de9ea89aa565bd83a2c082f90100000000ffffffff02c8736e0000000000225120c5c7c63798b59dc16e97d916011e99da5799d1b3dd81c2f2e93392477417e71e50c30000000000001976a914a579388225827d9f2fe9014add644487808c695d88ac01409f349704ee6e477058eb5d9b5ea2dd32b8cf22b14cd981416a9bec1cf032e233851842d0e8a4870b3ec86ad3c8e4bfcf97394d19c8ecd2498c89bcbba78c0eca00000000',
'010000000001010ab6ad3ba09261cfb4fa1d3680cb19332a8fe4d9de9ea89aa565bd83a2c082f90100000000ffffffff02c8736e0000000000225120c5c7c63798b59dc16e97d916011e99da5799d1b3dd81c2f2e93392477417e71e50c30000000000001976a914a579388225827d9f2fe9014add644487808c695d88ac014006bc29900d39570fca291c038551817430965ac6aa26f286483559e692a14a82cfaf8e57610eae12a5af05ee1e9600acb31de4757349c0e3066701aa78f65d2a00000000',
});

const forbiddenSignTx = await TrezorConnect.signTransaction(params);
Expand Down
4 changes: 2 additions & 2 deletions packages/connect/src/api/bitcoin/signtx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ export const signTx = async ({
}: SignTxHelperParams) => {
const { message } = await typedCall('SignTx', 'TxRequest', {
...options,
// nVersion, use 2 as it enables BIP68 + seems to be the most commonly used (= harder to fingerprint the Trezor)
version: options.version === undefined && coinInfo.isBitcoin ? 2 : options.version,
// nVersion, defaults to 1 in order to keep compatibility with 3rd parties, but expect 2 from Suite
version: options.version === undefined && coinInfo.isBitcoin ? 1 : options.version,
inputs_count: inputs.length,
outputs_count: outputs.length,
coin_name: coinInfo.name,
Expand Down
4 changes: 2 additions & 2 deletions packages/connect/src/api/bitcoin/signtxLegacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ export const signTxLegacy = async ({
}: SignTxHelperParams) => {
const { message } = await typedCall('SignTx', 'TxRequest', {
...options,
// nVersion, use 2 as it enables BIP68 + seems to be the most commonly used (= harder to fingerprint the Trezor)
version: options.version === undefined && coinInfo.isBitcoin ? 2 : options.version,
// nVersion, defaults to 1 in order to keep compatibility with 3rd parties, but expect 2 from Suite
version: options.version === undefined && coinInfo.isBitcoin ? 1 : options.version,
inputs_count: inputs.length,
outputs_count: outputs.length,
coin_name: coinInfo.name,
Expand Down
6 changes: 6 additions & 0 deletions suite-common/wallet-core/src/send/sendFormBitcoinThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
getUtxoOutpoint,
isRbfTransaction,
} from '@suite-common/wallet-utils';
import { BITCOIN_ONLY_NETWORKS } from '@suite-common/suite-constants';
import { BTC_LOCKTIME_SEQUENCE, BTC_RBF_SEQUENCE } from '@suite-common/wallet-constants';
import {
Account,
Expand Down Expand Up @@ -320,6 +321,11 @@ export const signBitcoinSendFormTransactionThunk = createThunk<
signEnhancement.unlockPath = selectedAccount.unlockPath;
}

if (BITCOIN_ONLY_NETWORKS.includes(selectedAccount.symbol)) {
// nVersion, use 2 as it enables BIP68 + seems to be the most commonly used (= harder to fingerprint the Trezor)
signEnhancement.version = 2;
}

const signPayload: Params<SignTransaction> = {
device: {
path: device.path,
Expand Down

0 comments on commit ee1c07f

Please sign in to comment.