Skip to content

Commit

Permalink
add try catch for when there are no inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
sosaucily committed Jun 28, 2024
1 parent a3f03f3 commit 8309f51
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/dlc-handlers/private-key-dlc-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,16 @@ export class PrivateKeyDLCHandler {
psbt.finalize();
break;
case 'deposit':
psbt.sign(this.getPrivateKey('p2tr'));
psbt.sign(this.getPrivateKey('p2wpkh'));
try {
psbt.sign(this.getPrivateKey('p2tr'));
} catch (error: any) {
// this can happen if there are no tr inputs to sign
}
try {
psbt.sign(this.getPrivateKey('p2wpkh'));
} catch (error: any) {
// this can happen if there are no p2wpkh inputs to sign
}
finalizeUserInputs(psbt, this.getPayment().nativeSegwitPayment);
break;
case 'withdraw':
Expand Down

0 comments on commit 8309f51

Please sign in to comment.