df: for rbfs, since we know what they asked for, we can abort

if they request less than we wanted/accepted

FIXME: add a test for this?
This commit is contained in:
niftynei 2022-09-22 14:22:01 -05:00 committed by Christian Decker
parent fa987f2344
commit 00d3e3e492
2 changed files with 19 additions and 0 deletions

View File

@ -3220,6 +3220,24 @@ static void rbf_local_start(struct state *state, u8 *msg)
goto free_rbf_ctx;
}
/* If their new amount is less than the lease we asked for,
* abort, abort! */
if (state->requested_lease
&& amount_sat_less(tx_state->accepter_funding,
*state->requested_lease)) {
negotiation_failed(state,
"We requested %s, which is more"
" than they've offered to provide"
" (%s)",
type_to_string(tmpctx,
struct amount_sat,
state->requested_lease),
type_to_string(tmpctx,
struct amount_sat,
&tx_state->accepter_funding));
goto free_rbf_ctx;
}
/* Now that we know the total of the channel, we can set the reserve */
set_reserve(tx_state, total, state->our_role);

View File

@ -343,6 +343,7 @@ def test_v2_rbf_single(node_factory, bitcoind, chainparams):
@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
@pytest.mark.openchannel('v2')
@pytest.mark.xfail
def test_v2_rbf_liquidity_ad(node_factory, bitcoind, chainparams):
opts = {'funder-policy': 'match', 'funder-policy-mod': 100,