funder: default to only funding leases

Make the default to only lease out funds.

Changelog-Changed: funder plugin defaults to leases-only
This commit is contained in:
niftynei 2021-08-05 12:31:49 -05:00 committed by Rusty Russell
parent 88f8e63ab6
commit 9df4234e8f
6 changed files with 18 additions and 12 deletions

@ -1 +1 @@
Subproject commit ff3750b0ce88130c09dcd02086340baaec2be016 Subproject commit 2b99492ed0544a6c0475a79ca4ed484bc9191635

View File

@ -95,9 +95,7 @@ default_funder_policy(const tal_t *ctx,
0, /* fuzz_factor */ 0, /* fuzz_factor */
AMOUNT_SAT(0), /* reserve_tank */ AMOUNT_SAT(0), /* reserve_tank */
100, 100,
/* Defaults to true iif we're advertising true, /* Leases-only by default */
* offers */
false,
NULL); NULL);
} }

View File

@ -489,7 +489,7 @@ int main(int argc, const char *argv[])
AMOUNT_SAT(50000), AMOUNT_SAT(50000),
AMOUNT_SAT(50000), AMOUNT_SAT(50000),
AMOUNT_SAT(100000), AMOUNT_SAT(100000),
AMOUNT_SAT(0), AMOUNT_SAT(100000),
&our_funds); &our_funds);
assert(amount_sat_eq(empty, our_funds)); assert(amount_sat_eq(empty, our_funds));
assert(!err); assert(!err);

View File

@ -857,7 +857,8 @@ def test_channel_lease_unilat_closes(node_factory, bitcoind):
l2-l3: l2 leases funds from l3; l3 goes to chain unilaterally l2-l3: l2 leases funds from l3; l3 goes to chain unilaterally
''' '''
opts = {'funder-policy': 'match', 'funder-policy-mod': 100, opts = {'funder-policy': 'match', 'funder-policy-mod': 100,
'lease-fee-base-msat': '100sat', 'lease-fee-basis': 100} 'lease-fee-base-msat': '100sat', 'lease-fee-basis': 100,
'funder-lease-requests-only': False}
l1, l2, l3 = node_factory.get_nodes(3, opts=opts) l1, l2, l3 = node_factory.get_nodes(3, opts=opts)
# Allow l2 some warnings # Allow l2 some warnings

View File

@ -410,7 +410,8 @@ def test_disconnect_fundee_v2(node_factory):
l2 = node_factory.get_node(disconnect=disconnects, l2 = node_factory.get_node(disconnect=disconnects,
options={'funder-policy': 'match', options={'funder-policy': 'match',
'funder-policy-mod': 100, 'funder-policy-mod': 100,
'funder-fuzz-percent': 0}) 'funder-fuzz-percent': 0,
'funder-lease-requests-only': False})
l1.fundwallet(2000000) l1.fundwallet(2000000)
l2.fundwallet(2000000) l2.fundwallet(2000000)
@ -1687,10 +1688,12 @@ def test_multifunding_v2_exclusive(node_factory, bitcoind):
options = [{}, options = [{},
{'funder-policy': 'match', {'funder-policy': 'match',
'funder-policy-mod': 100, 'funder-policy-mod': 100,
'funder-fuzz-percent': 0}, 'funder-fuzz-percent': 0,
'funder-lease-requests-only': False},
{'funder-policy': 'match', {'funder-policy': 'match',
'funder-policy-mod': 100, 'funder-policy-mod': 100,
'funder-fuzz-percent': 0}, 'funder-fuzz-percent': 0,
'funder-lease-requests-only': False},
{}] {}]
l1, l2, l3, l4 = node_factory.get_nodes(4, opts=options) l1, l2, l3, l4 = node_factory.get_nodes(4, opts=options)

View File

@ -1047,6 +1047,7 @@ def test_funder_options(node_factory, bitcoind):
assert funder_opts['reserve_tank_msat'] == Millisatoshi('0msat') assert funder_opts['reserve_tank_msat'] == Millisatoshi('0msat')
assert funder_opts['fuzz_percent'] == 0 assert funder_opts['fuzz_percent'] == 0
assert funder_opts['fund_probability'] == 100 assert funder_opts['fund_probability'] == 100
assert funder_opts['leases_only']
# l2 funds a chanenl with us. We don't contribute # l2 funds a chanenl with us. We don't contribute
l2.rpc.connect(l1.info['id'], 'localhost', l1.port) l2.rpc.connect(l1.info['id'], 'localhost', l1.port)
@ -1066,7 +1067,8 @@ def test_funder_options(node_factory, bitcoind):
'per_channel_max_msat': '10000000000msat', 'per_channel_max_msat': '10000000000msat',
'reserve_tank_msat': '3000000msat', 'reserve_tank_msat': '3000000msat',
'fund_probability': 99, 'fund_probability': 99,
'fuzz_percent': 0}) 'fuzz_percent': 0,
'leases_only': False})
assert funder_opts['policy'] == 'available' assert funder_opts['policy'] == 'available'
assert funder_opts['policy_mod'] == 100 assert funder_opts['policy_mod'] == 100
@ -1126,7 +1128,8 @@ def test_funder_contribution_limits(node_factory, bitcoind):
'min_their_funding_msat': '1000msat', 'min_their_funding_msat': '1000msat',
'per_channel_min_msat': '1000000msat', 'per_channel_min_msat': '1000000msat',
'fund_probability': 100, 'fund_probability': 100,
'fuzz_percent': 0}) 'fuzz_percent': 0,
'leases_only': False})
# Set our contribution to 50k sat, should only use 7 of 12 available utxos # Set our contribution to 50k sat, should only use 7 of 12 available utxos
l3.rpc.call('funderupdate', l3.rpc.call('funderupdate',
@ -1136,7 +1139,8 @@ def test_funder_contribution_limits(node_factory, bitcoind):
'per_channel_min_msat': '1000sat', 'per_channel_min_msat': '1000sat',
'per_channel_max_msat': '500000sat', 'per_channel_max_msat': '500000sat',
'fund_probability': 100, 'fund_probability': 100,
'fuzz_percent': 0}) 'fuzz_percent': 0,
'leases_only': False})
l1.rpc.connect(l2.info['id'], 'localhost', l2.port) l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
l1.fundchannel(l2, 10**7) l1.fundchannel(l2, 10**7)