Skip to content

Commit

Permalink
channeld: rename new_channel to new_full_channel.
Browse files Browse the repository at this point in the history
This avoids clashing with the new_channel we're about to add to lightningd,
and also matches its counterpart new_initial_channel.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Feb 14, 2018
1 parent 7eea02e commit fcffbd0
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 52 deletions.
18 changes: 9 additions & 9 deletions channeld/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2514,15 +2514,15 @@ static void init_channel(struct peer *peer)
derive_basepoints(&seed, &funding_pubkey[LOCAL], &points[LOCAL],
&peer->our_secrets, &peer->shaseed);

peer->channel = new_channel(peer, &funding_txid, funding_txout,
funding_satoshi,
local_msatoshi,
feerate_per_kw,
&peer->conf[LOCAL], &peer->conf[REMOTE],
&points[LOCAL], &points[REMOTE],
&funding_pubkey[LOCAL],
&funding_pubkey[REMOTE],
funder);
peer->channel = new_full_channel(peer, &funding_txid, funding_txout,
funding_satoshi,
local_msatoshi,
feerate_per_kw,
&peer->conf[LOCAL], &peer->conf[REMOTE],
&points[LOCAL], &points[REMOTE],
&funding_pubkey[LOCAL],
&funding_pubkey[REMOTE],
funder);

if (!channel_force_htlcs(peer->channel, htlcs, hstates,
fulfilled, fulfilled_sides,
Expand Down
26 changes: 13 additions & 13 deletions channeld/full_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
#include <inttypes.h>
#include <string.h>

struct channel *new_channel(const tal_t *ctx,
const struct bitcoin_txid *funding_txid,
unsigned int funding_txout,
u64 funding_satoshis,
u64 local_msatoshi,
const u32 feerate_per_kw[NUM_SIDES],
const struct channel_config *local,
const struct channel_config *remote,
const struct basepoints *local_basepoints,
const struct basepoints *remote_basepoints,
const struct pubkey *local_funding_pubkey,
const struct pubkey *remote_funding_pubkey,
enum side funder)
struct channel *new_full_channel(const tal_t *ctx,
const struct bitcoin_txid *funding_txid,
unsigned int funding_txout,
u64 funding_satoshis,
u64 local_msatoshi,
const u32 feerate_per_kw[NUM_SIDES],
const struct channel_config *local,
const struct channel_config *remote,
const struct basepoints *local_basepoints,
const struct basepoints *remote_basepoints,
const struct pubkey *local_funding_pubkey,
const struct pubkey *remote_funding_pubkey,
enum side funder)
{
struct channel *channel = new_initial_channel(ctx, funding_txid,
funding_txout,
Expand Down
28 changes: 14 additions & 14 deletions channeld/full_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <common/sphinx.h>

/**
* new_channel: Given initial fees and funding, what is initial state?
* new_full_channel: Given initial fees and funding, what is initial state?
* @ctx: tal context to allocate return value from.
* @funding_txid: The commitment transaction id.
* @funding_txout: The commitment transaction output number.
Expand All @@ -25,19 +25,19 @@
*
* Returns state, or NULL if malformed.
*/
struct channel *new_channel(const tal_t *ctx,
const struct bitcoin_txid *funding_txid,
unsigned int funding_txout,
u64 funding_satoshis,
u64 local_msatoshi,
const u32 feerate_per_kw[NUM_SIDES],
const struct channel_config *local,
const struct channel_config *remote,
const struct basepoints *local_basepoints,
const struct basepoints *remote_basepoints,
const struct pubkey *local_funding_pubkey,
const struct pubkey *remote_funding_pubkey,
enum side funder);
struct channel *new_full_channel(const tal_t *ctx,
const struct bitcoin_txid *funding_txid,
unsigned int funding_txout,
u64 funding_satoshis,
u64 local_msatoshi,
const u32 feerate_per_kw[NUM_SIDES],
const struct channel_config *local,
const struct channel_config *remote,
const struct basepoints *local_basepoints,
const struct basepoints *remote_basepoints,
const struct pubkey *local_funding_pubkey,
const struct pubkey *remote_funding_pubkey,
enum side funder);

/**
* channel_txs: Get the current commitment and htlc txs for the channel.
Expand Down
34 changes: 18 additions & 16 deletions channeld/test/run-full_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,22 +443,24 @@ int main(void)
to_local_msat = 7000000000;
to_remote_msat = 3000000000;
feerate_per_kw[LOCAL] = feerate_per_kw[REMOTE] = 15000;
lchannel = new_channel(tmpctx, &funding_txid, funding_output_index,
funding_amount_satoshi, to_local_msat,
feerate_per_kw,
local_config,
remote_config,
&localbase, &remotebase,
&local_funding_pubkey, &remote_funding_pubkey,
LOCAL);
rchannel = new_channel(tmpctx, &funding_txid, funding_output_index,
funding_amount_satoshi, to_remote_msat,
feerate_per_kw,
remote_config,
local_config,
&remotebase, &localbase,
&remote_funding_pubkey, &local_funding_pubkey,
REMOTE);
lchannel = new_full_channel(tmpctx, &funding_txid, funding_output_index,
funding_amount_satoshi, to_local_msat,
feerate_per_kw,
local_config,
remote_config,
&localbase, &remotebase,
&local_funding_pubkey,
&remote_funding_pubkey,
LOCAL);
rchannel = new_full_channel(tmpctx, &funding_txid, funding_output_index,
funding_amount_satoshi, to_remote_msat,
feerate_per_kw,
remote_config,
local_config,
&remotebase, &localbase,
&remote_funding_pubkey,
&local_funding_pubkey,
REMOTE);

/* BOLT #3:
*
Expand Down

0 comments on commit fcffbd0

Please sign in to comment.