Merge pull request #93 from ElementsProject/fix-87-open-too-small-for-fee

json_connect: don't try to double-fail if amount insufficient.
This commit is contained in:
Christian Decker
2016-11-16 13:04:26 +01:00
committed by GitHub

View File

@@ -3167,9 +3167,11 @@ static void json_connect(struct command *cmd,
/* FIXME: This is normal case, not exact. */ /* FIXME: This is normal case, not exact. */
fee = fee_by_feerate(94 + 1+73 + 1+33 + 1, get_feerate(cmd->dstate)); fee = fee_by_feerate(94 + 1+73 + 1+33 + 1, get_feerate(cmd->dstate));
if (fee >= connect->input->in_amount) if (fee >= connect->input->in_amount) {
command_fail(cmd, "Amount %"PRIu64" below fee %"PRIu64, command_fail(cmd, "Amount %"PRIu64" below fee %"PRIu64,
connect->input->in_amount, fee); connect->input->in_amount, fee);
return;
}
connect->input->out_amount = connect->input->in_amount - fee; connect->input->out_amount = connect->input->in_amount - fee;
if (anchor_too_large(connect->input->out_amount)) { if (anchor_too_large(connect->input->out_amount)) {