Skip to content

Commit 093561d

Browse files
committed
tx: disallow zero amount outputs for liquid.
Commit 8bc314f removed the output dust threshold, but did not consider outputs of 0 satoshis. Prevent this case and return a consistent error (invalid amount) for both BTC and Liquid if a 0-valued output is given.
1 parent b4a3529 commit 093561d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/transaction_utils.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,9 +807,13 @@ namespace green {
807807
return;
808808
}
809809

810-
if (!is_liquid && !addressee.value("is_greedy", false)) {
810+
if (!addressee.value("is_greedy", false)) {
811811
const auto satoshi = j_amountref(addressee);
812-
if (satoshi < session.get_dust_threshold(asset_id_hex)) {
812+
if (!satoshi.value()) {
813+
// TODO: Allow 0 OP_RETURN.
814+
throw user_error(res::id_invalid_amount);
815+
}
816+
if (!is_liquid && satoshi < session.get_dust_threshold(asset_id_hex)) {
813817
// Output is below the dust threshold. TODO: Allow 0 OP_RETURN.
814818
throw user_error(res::id_amount_below_the_dust_threshold);
815819
}

0 commit comments

Comments
 (0)