@@ -101,7 +101,7 @@ struct channel *new_full_channel(const tal_t *ctx,
101
101
const struct pubkey * local_funding_pubkey ,
102
102
const struct pubkey * remote_funding_pubkey ,
103
103
bool option_static_remotekey ,
104
- enum side funder )
104
+ enum side opener )
105
105
{
106
106
struct channel * channel = new_initial_channel (ctx ,
107
107
funding_txid ,
@@ -116,7 +116,7 @@ struct channel *new_full_channel(const tal_t *ctx,
116
116
local_funding_pubkey ,
117
117
remote_funding_pubkey ,
118
118
option_static_remotekey ,
119
- funder );
119
+ opener );
120
120
121
121
if (channel ) {
122
122
channel -> htlcs = tal (channel , struct htlc_map );
@@ -295,7 +295,7 @@ struct bitcoin_tx **channel_txs(const tal_t *ctx,
295
295
txs = tal_arr (ctx , struct bitcoin_tx * , 1 );
296
296
txs [0 ] = commit_tx (
297
297
ctx , & channel -> funding_txid , channel -> funding_txout ,
298
- channel -> funding , channel -> funder ,
298
+ channel -> funding , channel -> opener ,
299
299
channel -> config [!side ].to_self_delay , & keyset ,
300
300
channel_feerate (channel , side ),
301
301
channel -> config [side ].dust_limit , channel -> view [side ].owed [side ],
@@ -384,8 +384,8 @@ static struct amount_sat fee_for_htlcs(const struct channel *channel,
384
384
}
385
385
386
386
/*
387
- * There is a corner case where the funder can spend so much that the
388
- * non-funder can't add any non-dust HTLCs (since the funder would
387
+ * There is a corner case where the opener can spend so much that the
388
+ * non-opener can't add any non-dust HTLCs (since the opener would
389
389
* have to pay the additional fee, but it can't afford to). This
390
390
* leads to the channel starving at the feast! This was reported by
391
391
* ACINQ's @t-bast
@@ -394,7 +394,7 @@ static struct amount_sat fee_for_htlcs(const struct channel *channel,
394
394
* (https://github.com/ElementsProject/lightning/pull/3498).
395
395
*
396
396
* To mostly avoid this situation, at least from our side, we apply an
397
- * additional constraint when we're funder trying to add an HTLC: make
397
+ * additional constraint when we're opener trying to add an HTLC: make
398
398
* sure we can afford one more HTLC, even if fees increase by 100%.
399
399
*
400
400
* We could do this for the peer, as well, by rejecting their HTLC
@@ -408,7 +408,7 @@ static struct amount_sat fee_for_htlcs(const struct channel *channel,
408
408
* This mitigation will become BOLT #2 standard by:
409
409
* https://github.com/lightningnetwork/lightning-rfc/issues/740
410
410
*/
411
- static bool local_funder_has_fee_headroom (const struct channel * channel ,
411
+ static bool local_opener_has_fee_headroom (const struct channel * channel ,
412
412
struct amount_msat remainder ,
413
413
const struct htlc * * committed ,
414
414
const struct htlc * * adding ,
@@ -418,7 +418,7 @@ static bool local_funder_has_fee_headroom(const struct channel *channel,
418
418
size_t untrimmed ;
419
419
struct amount_sat fee ;
420
420
421
- assert (channel -> funder == LOCAL );
421
+ assert (channel -> opener == LOCAL );
422
422
423
423
/* How many untrimmed at current feerate? Increasing feerate can
424
424
* only *reduce* this number, so use current feerate here! */
@@ -540,7 +540,7 @@ static enum channel_add_err add_htlc(struct channel *channel,
540
540
*/
541
541
/* Also we should not add more htlc's than sender or recipient
542
542
* configured. This mitigates attacks in which a peer can force the
543
- * funder of the channel to pay unnecessary onchain fees during a fee
543
+ * opener of the channel to pay unnecessary onchain fees during a fee
544
544
* spike with large commitment transactions.
545
545
*/
546
546
min_concurrent_htlcs = channel -> config [recipient ].max_accepted_htlcs ;
@@ -614,7 +614,7 @@ static enum channel_add_err add_htlc(struct channel *channel,
614
614
& remainder ))
615
615
return CHANNEL_ERR_CHANNEL_CAPACITY_EXCEEDED ;
616
616
617
- if (channel -> funder == sender ) {
617
+ if (channel -> opener == sender ) {
618
618
if (amount_msat_less_sat (remainder , fee )) {
619
619
status_debug ("Cannot afford fee %s with %s above reserve" ,
620
620
type_to_string (tmpctx , struct amount_sat ,
@@ -625,7 +625,7 @@ static enum channel_add_err add_htlc(struct channel *channel,
625
625
}
626
626
627
627
if (sender == LOCAL
628
- && !local_funder_has_fee_headroom (channel ,
628
+ && !local_opener_has_fee_headroom (channel ,
629
629
remainder ,
630
630
committed ,
631
631
adding ,
@@ -634,12 +634,12 @@ static enum channel_add_err add_htlc(struct channel *channel,
634
634
}
635
635
}
636
636
637
- /* Try not to add a payment which will take funder into fees
637
+ /* Try not to add a payment which will take opener into fees
638
638
* on either our side or theirs. */
639
639
if (sender == LOCAL ) {
640
640
if (!get_room_above_reserve (channel , view ,
641
641
adding , removing ,
642
- channel -> funder ,
642
+ channel -> opener ,
643
643
& remainder ))
644
644
return CHANNEL_ERR_CHANNEL_CAPACITY_EXCEEDED ;
645
645
/* Should be able to afford both their own commit tx
@@ -649,7 +649,7 @@ static enum channel_add_err add_htlc(struct channel *channel,
649
649
committed ,
650
650
adding ,
651
651
removing ,
652
- channel -> funder );
652
+ channel -> opener );
653
653
/* set fee output pointer if given */
654
654
if (htlc_fee && amount_sat_greater (fee , * htlc_fee ))
655
655
* htlc_fee = fee ;
@@ -667,7 +667,7 @@ static enum channel_add_err add_htlc(struct channel *channel,
667
667
committed ,
668
668
adding ,
669
669
removing ,
670
- !channel -> funder );
670
+ !channel -> opener );
671
671
/* set fee output pointer if given */
672
672
if (htlc_fee && amount_sat_greater (fee , * htlc_fee ))
673
673
* htlc_fee = fee ;
@@ -970,7 +970,7 @@ u32 approx_max_feerate(const struct channel *channel)
970
970
struct amount_sat avail ;
971
971
const struct htlc * * committed , * * adding , * * removing ;
972
972
973
- gather_htlcs (tmpctx , channel , !channel -> funder ,
973
+ gather_htlcs (tmpctx , channel , !channel -> opener ,
974
974
& committed , & removing , & adding );
975
975
976
976
/* Assume none are trimmed; this gives lower bound on feerate. */
@@ -1001,28 +1001,28 @@ u32 approx_max_feerate(const struct channel *channel)
1001
1001
1002
1002
/* We should never go below reserve. */
1003
1003
if (!amount_sat_sub (& avail ,
1004
- amount_msat_to_sat_round_down (channel -> view [!channel -> funder ].owed [channel -> funder ]),
1005
- channel -> config [!channel -> funder ].channel_reserve ))
1004
+ amount_msat_to_sat_round_down (channel -> view [!channel -> opener ].owed [channel -> opener ]),
1005
+ channel -> config [!channel -> opener ].channel_reserve ))
1006
1006
avail = AMOUNT_SAT (0 );
1007
1007
1008
1008
return avail .satoshis / weight * 1000 ; /* Raw: once-off reverse feerate*/
1009
1009
}
1010
1010
1011
- bool can_funder_afford_feerate (const struct channel * channel , u32 feerate_per_kw )
1011
+ bool can_opener_afford_feerate (const struct channel * channel , u32 feerate_per_kw )
1012
1012
{
1013
1013
struct amount_sat needed , fee ;
1014
- struct amount_sat dust_limit = channel -> config [!channel -> funder ].dust_limit ;
1014
+ struct amount_sat dust_limit = channel -> config [!channel -> opener ].dust_limit ;
1015
1015
size_t untrimmed ;
1016
1016
const struct htlc * * committed , * * adding , * * removing ;
1017
- gather_htlcs (tmpctx , channel , !channel -> funder ,
1017
+ gather_htlcs (tmpctx , channel , !channel -> opener ,
1018
1018
& committed , & removing , & adding );
1019
1019
1020
1020
untrimmed = commit_tx_num_untrimmed (committed , feerate_per_kw , dust_limit ,
1021
- !channel -> funder )
1021
+ !channel -> opener )
1022
1022
+ commit_tx_num_untrimmed (adding , feerate_per_kw , dust_limit ,
1023
- !channel -> funder )
1023
+ !channel -> opener )
1024
1024
- commit_tx_num_untrimmed (removing , feerate_per_kw , dust_limit ,
1025
- !channel -> funder );
1025
+ !channel -> opener );
1026
1026
1027
1027
fee = commit_tx_base_fee (feerate_per_kw , untrimmed );
1028
1028
@@ -1032,38 +1032,38 @@ bool can_funder_afford_feerate(const struct channel *channel, u32 feerate_per_kw
1032
1032
* node's current commitment transaction:
1033
1033
* - SHOULD fail the channel
1034
1034
*/
1035
- /* Note: sender == funder */
1035
+ /* Note: sender == opener */
1036
1036
1037
1037
/* How much does it think it has? Must be >= reserve + fee */
1038
1038
if (!amount_sat_add (& needed , fee ,
1039
- channel -> config [!channel -> funder ].channel_reserve ))
1039
+ channel -> config [!channel -> opener ].channel_reserve ))
1040
1040
status_failed (STATUS_FAIL_INTERNAL_ERROR ,
1041
1041
"Cannot add fee %s and reserve %s" ,
1042
1042
type_to_string (tmpctx , struct amount_sat ,
1043
1043
& fee ),
1044
1044
type_to_string (tmpctx , struct amount_sat ,
1045
- & channel -> config [!channel -> funder ].channel_reserve ));
1045
+ & channel -> config [!channel -> opener ].channel_reserve ));
1046
1046
1047
1047
status_debug ("We need %s at feerate %u for %zu untrimmed htlcs: we have %s/%s" ,
1048
1048
type_to_string (tmpctx , struct amount_sat , & needed ),
1049
1049
feerate_per_kw , untrimmed ,
1050
1050
type_to_string (tmpctx , struct amount_msat ,
1051
- & channel -> view [LOCAL ].owed [channel -> funder ]),
1051
+ & channel -> view [LOCAL ].owed [channel -> opener ]),
1052
1052
type_to_string (tmpctx , struct amount_msat ,
1053
- & channel -> view [REMOTE ].owed [channel -> funder ]));
1054
- return amount_msat_greater_eq_sat (channel -> view [!channel -> funder ].owed [channel -> funder ],
1053
+ & channel -> view [REMOTE ].owed [channel -> opener ]));
1054
+ return amount_msat_greater_eq_sat (channel -> view [!channel -> opener ].owed [channel -> opener ],
1055
1055
needed );
1056
1056
}
1057
1057
1058
1058
bool channel_update_feerate (struct channel * channel , u32 feerate_per_kw )
1059
1059
{
1060
- if (!can_funder_afford_feerate (channel , feerate_per_kw ))
1060
+ if (!can_opener_afford_feerate (channel , feerate_per_kw ))
1061
1061
return false;
1062
1062
1063
1063
status_debug ("Setting %s feerate to %u" ,
1064
- side_to_str (!channel -> funder ), feerate_per_kw );
1064
+ side_to_str (!channel -> opener ), feerate_per_kw );
1065
1065
1066
- start_fee_update (channel -> fee_states , channel -> funder , feerate_per_kw );
1066
+ start_fee_update (channel -> fee_states , channel -> opener , feerate_per_kw );
1067
1067
return true;
1068
1068
}
1069
1069
0 commit comments