Skip to content

Commit 03f0c29

Browse files
committed
Fix signing inputs collection on xverse
I've updated the signingInput collection on the xverse service in order to select the inputs indexes of the created tx instead of the utxo. Reported by <lucio.serra@iovlabs.org>
1 parent 36f6b66 commit 03f0c29

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/common/services/XverseService.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ export default class XverseService extends WalletService {
5757
const xverseTx = tx as XverseTx;
5858
return new Promise<SignedTx>((resolve, reject) => {
5959
const signInputs: Record<string, number[]> = {};
60-
xverseTx.inputs.forEach((input: { address: string | number; idx: number; }) => {
61-
signInputs[input.address] = [input.idx];
60+
xverseTx.inputs.forEach((input: { address: string; idx: number; }, inputIdx) => {
61+
if (signInputs[input.address]) {
62+
signInputs[input.address].push(inputIdx);
63+
} else {
64+
signInputs[input.address] = [inputIdx];
65+
}
6266
});
6367
const signPsbtOptions = {
6468
psbt: xverseTx.base64UnsignedPsbt,

src/pegin/middleware/TxBuilder/XverseTxBuilder.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export interface XverseTx extends Tx {
1515

1616
export default class XverseTxBuilder extends TxBuilder {
1717
buildTx(normalizedTx: NormalizedTx): Promise<XverseTx> {
18-
console.log('XverseTxBuilder.buildTx()');
1918
return new Promise<XverseTx>((resolve, reject) => {
2019
const psbt = new bitcoin.Psbt({ network: this.network });
2120
this.getExtendedInputs(normalizedTx.inputs)

0 commit comments

Comments
 (0)