Skip to content

Commit

Permalink
fix: estimate higher tx size for inscription sends, closes #5330
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie authored and alter-eggo committed May 2, 2024
1 parent d0457fb commit 8ba6258
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe(selectTaprootInscriptionTransferCoins.name, () => {
Number(inscriptionInputAmount)
);

expect(result.txFee).toEqual(5048);
expect(result.txFee).toEqual(6608);
});

test('when there are not enough utxo to cover fee', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ export function selectTaprootInscriptionTransferCoins(
const txSizer = new BtcSizeFeeEstimator();

const initialTxSize = txSizer.calcTxSize({
input_script: 'p2tr',
input_script: 'p2wpkh',
input_count: 1,
// From the address of the recipient, we infer the output type
p2tr_output_count: 1,
p2wpkh_output_count: 1,
});

const neededInputs: UtxoResponseItem[] = [];
Expand All @@ -65,9 +66,10 @@ export function selectTaprootInscriptionTransferCoins(
if (nextUtxo) neededInputs.push(nextUtxo);
utxos = remainingUtxos;
txSize = txSizer.calcTxSize({
input_script: 'p2tr',
input_script: 'p2wpkh',
input_count: neededInputs.length + 1,
p2tr_output_count: 1,
p2wpkh_output_count: 1,
});
indexCounter.increment();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function useGenerateUnsignedOrdinalTx(inscriptionInput: UtxoWithDerivatio
if (e instanceof InsufficientFundsError) {
throw new InsufficientFundsError();
}
logger.error('Unable to sign transaction');
logger.error('Unable to sign transaction', e);
return null;
}
}
Expand Down Expand Up @@ -159,7 +159,7 @@ export function useGenerateUnsignedOrdinalTx(inscriptionInput: UtxoWithDerivatio
if (e instanceof InsufficientFundsError) {
throw new InsufficientFundsError();
}
logger.error('Unable to sign transaction');
logger.error('Unable to sign transaction', e);
return null;
}
}
Expand Down

0 comments on commit 8ba6258

Please sign in to comment.