Skip to content

Commit c313cda

Browse files
committed
[Issue 228] [fix] - finalize when sign psbt
1 parent 9f31123 commit c313cda

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

packages/extension-base/src/services/request-service/handler/BitcoinRequestHandler.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,11 @@ export default class BitcoinRequestHandler {
324324
throw new Error('Unable to sign');
325325
}
326326

327-
if (!broadcast) {
328-
for (const index of signAtIndexGenerate) {
329-
psptSignedTransaction.finalizeInput(index);
330-
}
327+
for (const index of signAtIndexGenerate) {
328+
psptSignedTransaction.finalizeInput(index);
329+
}
331330

331+
if (!broadcast) {
332332
return {
333333
psbt: psptSignedTransaction.toHex()
334334
};
@@ -353,13 +353,6 @@ export default class BitcoinRequestHandler {
353353

354354
const chainInfo = this.#chainService.getChainInfoByKey(chain);
355355

356-
try {
357-
psptSignedTransaction.finalizeAllInputs();
358-
} catch (e) {
359-
emitterTransaction.emit('error', { ...eventData, errors: [new TransactionError(BasicTxErrorType.INVALID_PARAMS, (e as Error).message)] });
360-
throw new Error((e as Error).message);
361-
}
362-
363356
const hexTransaction = psptSignedTransaction.extractTransaction().toHex();
364357

365358
this.#transactionService.emitterEventTransaction(emitterTransaction, eventData, chainInfo.slug, hexTransaction);

0 commit comments

Comments
 (0)