mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
df: rename 'funder' to 'opener'
Previously we've used the term 'funder' to refer to the peer paying the fees for a transaction; v2 of openchannel will make this no longer true. Instead we rename this to 'opener', or the peer sending the 'open_channel' message, since this will be universally true in a dual-funding world.
This commit is contained in:
committed by
Rusty Russell
parent
964a3583c4
commit
0e20e3c5e7
@@ -145,7 +145,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
|
||||
/* NULL or stolen */
|
||||
struct wallet_shachain *their_shachain,
|
||||
enum channel_state state,
|
||||
enum side funder,
|
||||
enum side opener,
|
||||
/* NULL or stolen */
|
||||
struct log *log,
|
||||
const char *transient_billboard TAKES,
|
||||
@@ -204,7 +204,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
|
||||
shachain_init(&channel->their_shachain.chain);
|
||||
}
|
||||
channel->state = state;
|
||||
channel->funder = funder;
|
||||
channel->opener = opener;
|
||||
channel->owner = NULL;
|
||||
memset(&channel->billboard, 0, sizeof(channel->billboard));
|
||||
channel->billboard.transient = tal_strdup(channel, transient_billboard);
|
||||
@@ -427,7 +427,7 @@ void channel_fail_forget(struct channel *channel, const char *fmt, ...)
|
||||
char *why;
|
||||
struct channel_id cid;
|
||||
|
||||
assert(channel->funder == REMOTE &&
|
||||
assert(channel->opener == REMOTE &&
|
||||
channel->state == CHANNELD_AWAITING_LOCKIN);
|
||||
va_start(ap, fmt);
|
||||
why = tal_vfmt(tmpctx, fmt, ap);
|
||||
|
||||
@@ -34,7 +34,7 @@ struct channel {
|
||||
enum channel_state state;
|
||||
|
||||
/* Which side offered channel? */
|
||||
enum side funder;
|
||||
enum side opener;
|
||||
|
||||
/* Is there a single subdaemon responsible for us? */
|
||||
struct subd *owner;
|
||||
@@ -135,7 +135,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
|
||||
/* NULL or stolen */
|
||||
struct wallet_shachain *their_shachain STEALS,
|
||||
enum channel_state state,
|
||||
enum side funder,
|
||||
enum side opener,
|
||||
/* NULL or stolen */
|
||||
struct log *log STEALS,
|
||||
const char *transient_billboard TAKES,
|
||||
|
||||
@@ -481,7 +481,7 @@ void peer_start_channeld(struct channel *channel,
|
||||
&channel->channel_info.theirbase,
|
||||
&channel->channel_info.remote_per_commit,
|
||||
&channel->channel_info.old_remote_per_commit,
|
||||
channel->funder,
|
||||
channel->opener,
|
||||
channel->feerate_base,
|
||||
channel->feerate_ppm,
|
||||
channel->our_msat,
|
||||
@@ -523,7 +523,7 @@ void peer_start_channeld(struct channel *channel,
|
||||
subd_send_msg(channel->owner, take(initmsg));
|
||||
|
||||
/* On restart, feerate might not be what we expect: adjust now. */
|
||||
if (channel->funder == LOCAL)
|
||||
if (channel->opener == LOCAL)
|
||||
try_update_feerates(ld, channel);
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ is_fundee_should_forget(struct lightningd *ld,
|
||||
*/
|
||||
|
||||
/* Only applies if we are fundee. */
|
||||
if (channel->funder == LOCAL)
|
||||
if (channel->opener == LOCAL)
|
||||
return false;
|
||||
|
||||
/* Does not apply if we already saw the funding tx. */
|
||||
@@ -746,7 +746,7 @@ struct command_result *cancel_channel_before_broadcast(struct command *cmd,
|
||||
buffer + cidtok->start);
|
||||
}
|
||||
|
||||
if (cancel_channel->funder == REMOTE)
|
||||
if (cancel_channel->opener == REMOTE)
|
||||
return command_fail(cmd, LIGHTNINGD,
|
||||
"Cannot cancel channel that was "
|
||||
"initiated by peer");
|
||||
|
||||
@@ -217,7 +217,7 @@ void peer_start_closingd(struct channel *channel,
|
||||
* [BOLT #3](03-transactions.md#fee-calculation).
|
||||
*/
|
||||
final_commit_feerate = get_feerate(channel->channel_info.fee_states,
|
||||
channel->funder, LOCAL);
|
||||
channel->opener, LOCAL);
|
||||
feelimit = commit_tx_base_fee(final_commit_feerate, 0);
|
||||
|
||||
/* Pick some value above slow feerate (or min possible if unknown) */
|
||||
@@ -283,7 +283,7 @@ void peer_start_closingd(struct channel *channel,
|
||||
channel->funding,
|
||||
&channel->local_funding_pubkey,
|
||||
&channel->channel_info.remote_fundingkey,
|
||||
channel->funder,
|
||||
channel->opener,
|
||||
amount_msat_to_sat_round_down(channel->our_msat),
|
||||
amount_msat_to_sat_round_down(their_msat),
|
||||
channel->our_config.dust_limit,
|
||||
|
||||
@@ -51,7 +51,7 @@ struct config {
|
||||
/* How long between changing commit and sending COMMIT message. */
|
||||
u32 commit_time_ms;
|
||||
|
||||
/* Do we let the funder set any fee rate they want */
|
||||
/* Do we let the opener set any fee rate they want */
|
||||
bool ignore_fee_limits;
|
||||
|
||||
/* Number of blocks to rescan from the current head, or absolute
|
||||
|
||||
@@ -560,7 +560,7 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
|
||||
channel->shutdown_scriptpubkey[LOCAL],
|
||||
channel->shutdown_scriptpubkey[REMOTE],
|
||||
&final_key,
|
||||
channel->funder,
|
||||
channel->opener,
|
||||
&channel->local_basepoints,
|
||||
&channel->channel_info.theirbase,
|
||||
tx,
|
||||
|
||||
@@ -64,7 +64,7 @@ struct uncommitted_channel {
|
||||
|
||||
/* These are *not* filled in by new_uncommitted_channel: */
|
||||
|
||||
/* Minimum funding depth (if funder == REMOTE). */
|
||||
/* Minimum funding depth (if opener == REMOTE). */
|
||||
u32 minimum_depth;
|
||||
|
||||
/* Our channel config. */
|
||||
|
||||
@@ -424,7 +424,7 @@ void channel_errmsg(struct channel *channel,
|
||||
|
||||
/* We should immediately forget the channel if we receive error during
|
||||
* CHANNELD_AWAITING_LOCKIN if we are fundee. */
|
||||
if (!err_for_them && channel->funder == REMOTE
|
||||
if (!err_for_them && channel->opener == REMOTE
|
||||
&& channel->state == CHANNELD_AWAITING_LOCKIN)
|
||||
channel_fail_forget(channel, "%s: %s ERROR %s",
|
||||
channel->owner->name,
|
||||
@@ -453,7 +453,7 @@ static void json_add_htlcs(struct lightningd *ld,
|
||||
const struct htlc_out *hout;
|
||||
struct htlc_out_map_iter outi;
|
||||
u32 local_feerate = get_feerate(channel->channel_info.fee_states,
|
||||
channel->funder, LOCAL);
|
||||
channel->opener, LOCAL);
|
||||
|
||||
/* FIXME: Add more fields. */
|
||||
json_array_start(response, "htlcs");
|
||||
@@ -526,7 +526,7 @@ static struct amount_sat commit_txfee(const struct channel *channel,
|
||||
struct lightningd *ld = channel->peer->ld;
|
||||
size_t num_untrimmed_htlcs = 0;
|
||||
u32 feerate = get_feerate(channel->channel_info.fee_states,
|
||||
channel->funder, side);
|
||||
channel->opener, side);
|
||||
struct amount_sat dust_limit;
|
||||
if (side == LOCAL)
|
||||
dust_limit = channel->our_config.dust_limit;
|
||||
@@ -656,7 +656,7 @@ static void json_add_channel(struct lightningd *ld,
|
||||
// FIXME @conscott : Modify this when dual-funded channels
|
||||
// are implemented
|
||||
json_object_start(response, "funding_allocation_msat");
|
||||
if (channel->funder == LOCAL) {
|
||||
if (channel->opener == LOCAL) {
|
||||
json_add_u64(response, node_id_to_hexstr(tmpctx, &p->id), 0);
|
||||
json_add_u64(response, node_id_to_hexstr(tmpctx, &ld->id),
|
||||
channel->funding.satoshis * 1000); /* Raw: raw JSON field */
|
||||
@@ -668,7 +668,7 @@ static void json_add_channel(struct lightningd *ld,
|
||||
json_object_end(response);
|
||||
|
||||
json_object_start(response, "funding_msat");
|
||||
if (channel->funder == LOCAL) {
|
||||
if (channel->opener == LOCAL) {
|
||||
json_add_sat_only(response,
|
||||
node_id_to_hexstr(tmpctx, &p->id),
|
||||
AMOUNT_SAT(0));
|
||||
@@ -735,8 +735,8 @@ static void json_add_channel(struct lightningd *ld,
|
||||
/* Take away any currently-offered HTLCs. */
|
||||
subtract_offered_htlcs(channel, &spendable);
|
||||
|
||||
/* If we're funder, subtract txfees we'll need to spend this */
|
||||
if (channel->funder == LOCAL) {
|
||||
/* If we're opener, subtract txfees we'll need to spend this */
|
||||
if (channel->opener == LOCAL) {
|
||||
if (!amount_msat_sub_sat(&spendable, spendable,
|
||||
commit_txfee(channel, spendable,
|
||||
LOCAL)))
|
||||
@@ -767,8 +767,8 @@ static void json_add_channel(struct lightningd *ld,
|
||||
/* Take away any currently-offered HTLCs. */
|
||||
subtract_received_htlcs(channel, &receivable);
|
||||
|
||||
/* If they're funder, subtract txfees they'll need to spend this */
|
||||
if (channel->funder == REMOTE) {
|
||||
/* If they're opener, subtract txfees they'll need to spend this */
|
||||
if (channel->opener == REMOTE) {
|
||||
if (!amount_msat_sub_sat(&receivable, receivable,
|
||||
commit_txfee(channel,
|
||||
receivable, REMOTE)))
|
||||
|
||||
@@ -1676,7 +1676,7 @@ void peer_sending_commitsig(struct channel *channel, const u8 *msg)
|
||||
&fee_states,
|
||||
&changed_htlcs,
|
||||
&commit_sig, &htlc_sigs)
|
||||
|| !fee_states_valid(fee_states, channel->funder)) {
|
||||
|| !fee_states_valid(fee_states, channel->opener)) {
|
||||
channel_internal_error(channel, "bad channel_sending_commitsig %s",
|
||||
tal_hex(channel, msg));
|
||||
return;
|
||||
@@ -1716,7 +1716,7 @@ void peer_sending_commitsig(struct channel *channel, const u8 *msg)
|
||||
channel->channel_info.fee_states = tal_steal(channel, fee_states);
|
||||
adjust_channel_feerate_bounds(channel,
|
||||
get_feerate(fee_states,
|
||||
channel->funder,
|
||||
channel->opener,
|
||||
REMOTE));
|
||||
|
||||
if (!peer_save_commitsig_sent(channel, commitnum))
|
||||
@@ -1871,7 +1871,7 @@ void peer_got_commitsig(struct channel *channel, const u8 *msg)
|
||||
&failed,
|
||||
&changed,
|
||||
&tx)
|
||||
|| !fee_states_valid(fee_states, channel->funder)) {
|
||||
|| !fee_states_valid(fee_states, channel->opener)) {
|
||||
channel_internal_error(channel,
|
||||
"bad fromwire_channel_got_commitsig %s",
|
||||
tal_hex(channel, msg));
|
||||
@@ -1901,7 +1901,7 @@ void peer_got_commitsig(struct channel *channel, const u8 *msg)
|
||||
log_debug(channel->log,
|
||||
"got commitsig %"PRIu64
|
||||
": feerate %u, %zu added, %zu fulfilled, %zu failed, %zu changed",
|
||||
commitnum, get_feerate(fee_states, channel->funder, LOCAL),
|
||||
commitnum, get_feerate(fee_states, channel->opener, LOCAL),
|
||||
tal_count(added), tal_count(fulfilled),
|
||||
tal_count(failed), tal_count(changed));
|
||||
|
||||
@@ -1934,7 +1934,7 @@ void peer_got_commitsig(struct channel *channel, const u8 *msg)
|
||||
channel->channel_info.fee_states = tal_steal(channel, fee_states);
|
||||
adjust_channel_feerate_bounds(channel,
|
||||
get_feerate(fee_states,
|
||||
channel->funder,
|
||||
channel->opener,
|
||||
LOCAL));
|
||||
|
||||
/* Since we're about to send revoke, bump state again. */
|
||||
@@ -1982,7 +1982,7 @@ void peer_got_revoke(struct channel *channel, const u8 *msg)
|
||||
&next_per_commitment_point,
|
||||
&fee_states,
|
||||
&changed)
|
||||
|| !fee_states_valid(fee_states, channel->funder)) {
|
||||
|| !fee_states_valid(fee_states, channel->opener)) {
|
||||
channel_internal_error(channel, "bad fromwire_channel_got_revoke %s",
|
||||
tal_hex(channel, msg));
|
||||
return;
|
||||
|
||||
@@ -133,7 +133,7 @@ u32 get_block_height(const struct chain_topology *topo UNNEEDED)
|
||||
{ fprintf(stderr, "get_block_height called!\n"); abort(); }
|
||||
/* Generated stub for get_feerate */
|
||||
u32 get_feerate(const struct fee_states *fee_states UNNEEDED,
|
||||
enum side funder UNNEEDED,
|
||||
enum side opener UNNEEDED,
|
||||
enum side side UNNEEDED)
|
||||
{ fprintf(stderr, "get_feerate called!\n"); abort(); }
|
||||
/* Generated stub for htlc_is_trimmed */
|
||||
|
||||
Reference in New Issue
Block a user