Skip to content

Commit 6681c74

Browse files
OttoAllmendingerllm-git
andcommitted
feat(abstract-utxo): default testnet transactions to PSBT format
Remove special case for ZCash - all testnets now default to PSBT format. Simplify conditional logic by removing unnecessary ZCash exclusions from unit tests and defaulting logic. Issue: BTC-2732 Co-authored-by: llm-git <[email protected]>
1 parent 076170e commit 6681c74

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

modules/abstract-utxo/src/abstractUtxoCoin.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -971,10 +971,6 @@ export abstract class AbstractUtxoCoin extends BaseCoin {
971971
return requestedFormat;
972972
}
973973

974-
if (getMainnet(this.network) === utxolib.networks.zcash) {
975-
return undefined;
976-
}
977-
978974
if (isTestnet(this.network)) {
979975
return 'psbt';
980976
}

modules/abstract-utxo/test/unit/txFormat.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,35 +103,25 @@ function runTest(params: {
103103

104104
describe('txFormat', function () {
105105
describe('getDefaultTxFormat', function () {
106-
// ZCash never defaults to PSBT
106+
// All testnet wallets default to PSBT
107107
runTest({
108-
description: 'should never return psbt for zcash',
109-
coinFilter: (coin) => utxolib.getMainnet(coin.network) === utxolib.networks.zcash,
110-
expectedTxFormat: undefined,
111-
});
112-
113-
// All non-ZCash testnet wallets default to PSBT
114-
runTest({
115-
description: 'should always return psbt for testnet (non-zcash)',
116-
coinFilter: (coin) =>
117-
utxolib.isTestnet(coin.network) && utxolib.getMainnet(coin.network) !== utxolib.networks.zcash,
108+
description: 'should always return psbt for testnet',
109+
coinFilter: (coin) => utxolib.isTestnet(coin.network),
118110
expectedTxFormat: 'psbt',
119111
});
120112

121113
// DistributedCustody wallets default to PSBT (mainnet only, testnet already covered)
122114
runTest({
123115
description: 'should return psbt for distributedCustody wallets on mainnet',
124-
coinFilter: (coin) =>
125-
utxolib.isMainnet(coin.network) && utxolib.getMainnet(coin.network) !== utxolib.networks.zcash,
116+
coinFilter: (coin) => utxolib.isMainnet(coin.network),
126117
walletFilter: (w) => w.options.subType === 'distributedCustody',
127118
expectedTxFormat: 'psbt',
128119
});
129120

130121
// MuSig2 wallets default to PSBT (mainnet only, testnet already covered)
131122
runTest({
132123
description: 'should return psbt for wallets with musigKp flag on mainnet',
133-
coinFilter: (coin) =>
134-
utxolib.isMainnet(coin.network) && utxolib.getMainnet(coin.network) !== utxolib.networks.zcash,
124+
coinFilter: (coin) => utxolib.isMainnet(coin.network),
135125
walletFilter: (w) => Boolean(w.options.walletFlags?.some((f) => f.name === 'musigKp' && f.value === 'true')),
136126
expectedTxFormat: 'psbt',
137127
});
@@ -148,8 +138,7 @@ describe('txFormat', function () {
148138
// Other mainnet wallets do NOT default to PSBT
149139
runTest({
150140
description: 'should return undefined for other mainnet wallets',
151-
coinFilter: (coin) =>
152-
utxolib.isMainnet(coin.network) && utxolib.getMainnet(coin.network) !== utxolib.networks.zcash,
141+
coinFilter: (coin) => utxolib.isMainnet(coin.network),
153142
walletFilter: (w) => {
154143
const isHotBitcoin = w.options.type === 'hot'; // This will be bitcoin hot wallets
155144
const isDistributedCustody = w.options.subType === 'distributedCustody';

0 commit comments

Comments
 (0)