Skip to content

Commit 8c2bb89

Browse files
OttoAllmendingerllm-git
andcommitted
feat(abstract-utxo): add getReplayProtectionPubkeys function
Add function to generate replay protection pubkeys and use it in tests Issue: BTC-2656 Co-authored-by: llm-git <[email protected]>
1 parent 90d369e commit 8c2bb89

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
WalletSignTransactionOptions,
1414
} from '@bitgo/sdk-core';
1515

16-
import { AbstractUtxoCoin, getReplayProtectionAddresses, generateAddress } from '../../src';
16+
import { AbstractUtxoCoin, getReplayProtectionAddresses, generateAddress, getReplayProtectionPubkeys } from '../../src';
1717
import { SdkBackend } from '../../src/transaction/types';
1818

1919
import { hasWasmUtxoSupport } from './transaction/fixedScript/util';
@@ -176,7 +176,9 @@ describe(`UTXO coin signTransaction`, async function () {
176176
}));
177177
const unspentSum = inputs.reduce((prev: bigint, curr) => prev + curr.value, BigInt(0));
178178
const outputs: testutil.Output[] = [{ scriptType: 'p2sh', value: unspentSum - BigInt(1000) }];
179-
const psbt = testutil.constructPsbt(inputs, outputs, coin.network, rootWalletKeys, 'unsigned');
179+
const psbt = testutil.constructPsbt(inputs, outputs, coin.network, rootWalletKeys, 'unsigned', {
180+
p2shP2pkKey: getReplayProtectionPubkeys(coin.network)[0],
181+
});
180182

181183
for (const v of [false, true]) {
182184
await signTransaction(psbt, v);
@@ -402,7 +404,9 @@ function run<TNumber extends number | bigint = number>(
402404
const outputs: testutil.Output[] = [
403405
{ address: getOutputAddress(getWalletKeys('test')), value: unspentSum - BigInt(1000) },
404406
];
405-
const psbt = testutil.constructPsbt(inputs, outputs, coin.network, walletKeys, 'unsigned');
407+
const psbt = testutil.constructPsbt(inputs, outputs, coin.network, walletKeys, 'unsigned', {
408+
p2shP2pkKey: getReplayProtectionPubkeys(coin.network)[0],
409+
});
406410
utxolib.bitgo.addXpubsToPsbt(psbt, walletKeys);
407411
return psbt;
408412
}

0 commit comments

Comments
 (0)