Skip to content

Commit 42007f3

Browse files
OttoAllmendingerllm-git
andcommitted
fix(abstract-utxo): improve error message for invalid recipients
Improve error message for non-encodeable scriptPubkeys by displaying the amount and address directly instead of stringifying the entire output object, which can cause issues with bigint values. Issue: BTC-2732 Co-authored-by: llm-git <llm-git@ttll.de>
1 parent c297db0 commit 42007f3

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

modules/abstract-utxo/src/transaction/recipient.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ export function assertValidTransactionRecipient(output: { amount: bigint | numbe
4747
// We will verify that the amount is zero, and if it isnt then we will throw an error.
4848
if (!output.address || isScriptRecipient(output.address)) {
4949
if (output.amount.toString() !== '0') {
50-
throw new Error(`Only zero amounts allowed for non-encodeable scriptPubkeys: ${JSON.stringify(output)}`);
50+
throw new Error(
51+
`Only zero amounts allowed for non-encodeable scriptPubkeys: amount: ${output.amount}, address: ${output.address}`
52+
);
5153
}
5254
}
5355
}

0 commit comments

Comments
 (0)