mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
whitespace changes, 80 chars etc
This commit is contained in:
parent
01e37d61e8
commit
0bb483f9b1
@ -95,19 +95,21 @@ static void record_channel_open(struct channel *channel)
|
||||
type_to_string(tmpctx, struct amount_sat,
|
||||
&channel->funding));
|
||||
|
||||
/* if we pushed sats, we should decrement that from the channel balance */
|
||||
/* if we pushed sats, we should decrement that
|
||||
* from the channel balance */
|
||||
if (amount_msat_greater(channel->push, AMOUNT_MSAT(0))) {
|
||||
mvt = new_coin_pushed(ctx, type_to_string(tmpctx,
|
||||
struct channel_id,
|
||||
&channel->cid),
|
||||
mvt = new_coin_pushed(ctx,
|
||||
type_to_string(tmpctx,
|
||||
struct channel_id,
|
||||
&channel->cid),
|
||||
&channel->funding_txid,
|
||||
blockheight, channel->push);
|
||||
notify_chain_mvt(channel->peer->ld, mvt);
|
||||
}
|
||||
} else {
|
||||
/* we're not the funder, we record our 'opening balance' anyway
|
||||
* (there's a small chance we were pushed some satoshis, otherwise
|
||||
* it's zero) */
|
||||
/* we're not the funder, we record our 'opening balance'
|
||||
* anyway (there's a small chance we were pushed some
|
||||
* satoshis, otherwise it's zero) */
|
||||
channel_open_amt = channel->our_msat;
|
||||
}
|
||||
|
||||
@ -313,7 +315,9 @@ static void forget(struct channel *channel)
|
||||
|
||||
struct json_stream *response;
|
||||
response = json_stream_success(forgets[i]);
|
||||
json_add_string(response, "cancelled", "Channel open canceled by RPC(after fundchannel_complete)");
|
||||
json_add_string(response, "cancelled",
|
||||
"Channel open canceled by RPC(after"
|
||||
" fundchannel_complete)");
|
||||
was_pending(command_success(forgets[i], response));
|
||||
}
|
||||
|
||||
@ -508,10 +512,13 @@ void peer_start_channeld(struct channel *channel,
|
||||
if (ld->config.ignore_fee_limits)
|
||||
log_debug(channel->log, "Ignoring fee limits!");
|
||||
|
||||
if (!wallet_remote_ann_sigs_load(tmpctx, channel->peer->ld->wallet, channel->dbid,
|
||||
&remote_ann_node_sig, &remote_ann_bitcoin_sig)) {
|
||||
if (!wallet_remote_ann_sigs_load(tmpctx, channel->peer->ld->wallet,
|
||||
channel->dbid,
|
||||
&remote_ann_node_sig,
|
||||
&remote_ann_bitcoin_sig)) {
|
||||
channel_internal_error(channel,
|
||||
"Could not load remote announcement signatures");
|
||||
"Could not load remote announcement"
|
||||
" signatures");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -587,9 +594,9 @@ void peer_start_channeld(struct channel *channel,
|
||||
}
|
||||
|
||||
bool channel_tell_depth(struct lightningd *ld,
|
||||
struct channel *channel,
|
||||
const struct bitcoin_txid *txid,
|
||||
u32 depth)
|
||||
struct channel *channel,
|
||||
const struct bitcoin_txid *txid,
|
||||
u32 depth)
|
||||
{
|
||||
const char *txidstr;
|
||||
|
||||
@ -803,23 +810,24 @@ struct command_result *cancel_channel_before_broadcast(struct command *cmd,
|
||||
"Cannot cancel channel that was "
|
||||
"initiated by peer");
|
||||
|
||||
/* Check if we broadcast the transaction. (We store the transaction type into DB
|
||||
* before broadcast). */
|
||||
/* Check if we broadcast the transaction. (We store the transaction
|
||||
* type into DB before broadcast). */
|
||||
enum wallet_tx_type type;
|
||||
if (wallet_transaction_type(cmd->ld->wallet,
|
||||
&cancel_channel->funding_txid,
|
||||
&type))
|
||||
return command_fail(cmd, FUNDING_CANCEL_NOT_SAFE,
|
||||
"Has the funding transaction been broadcast? "
|
||||
"Please use `close` or `dev-fail` instead.");
|
||||
"Has the funding transaction been"
|
||||
" broadcast? Please use `close` or"
|
||||
" `dev-fail` instead.");
|
||||
|
||||
if (channel_has_htlc_out(cancel_channel) ||
|
||||
channel_has_htlc_in(cancel_channel)) {
|
||||
return command_fail(cmd, FUNDING_CANCEL_NOT_SAFE,
|
||||
"This channel has HTLCs attached and it is "
|
||||
"not safe to cancel. Has the funding transaction "
|
||||
"been broadcast? Please use `close` or `dev-fail` "
|
||||
"instead.");
|
||||
"This channel has HTLCs attached and it"
|
||||
" is not safe to cancel. Has the funding"
|
||||
" transaction been broadcast? Please use"
|
||||
" `close` or `dev-fail` instead.");
|
||||
}
|
||||
|
||||
tal_arr_expand(&cancel_channel->forgets, cmd);
|
||||
@ -827,7 +835,8 @@ struct command_result *cancel_channel_before_broadcast(struct command *cmd,
|
||||
/* Check if the transaction is onchain. */
|
||||
/* Note: The above check and this check can't completely ensure that
|
||||
* the funding transaction isn't broadcast. We can't know if the funding
|
||||
* is broadcast by external wallet and the transaction hasn't been onchain. */
|
||||
* is broadcast by external wallet and the transaction hasn't
|
||||
* been onchain. */
|
||||
bitcoind_getutxout(cmd->ld->topology->bitcoind,
|
||||
&cancel_channel->funding_txid,
|
||||
cancel_channel->funding_outnum,
|
||||
@ -864,9 +873,10 @@ static struct command_result *json_dev_feerate(struct command *cmd,
|
||||
return command_fail(cmd, LIGHTNINGD, "Peer bad state");
|
||||
|
||||
msg = towire_channeld_feerates(NULL, *feerate,
|
||||
feerate_min(cmd->ld, NULL),
|
||||
feerate_max(cmd->ld, NULL),
|
||||
try_get_feerate(cmd->ld->topology, FEERATE_PENALTY));
|
||||
feerate_min(cmd->ld, NULL),
|
||||
feerate_max(cmd->ld, NULL),
|
||||
try_get_feerate(cmd->ld->topology,
|
||||
FEERATE_PENALTY));
|
||||
subd_send_msg(channel->owner, take(msg));
|
||||
|
||||
response = json_stream_success(cmd);
|
||||
|
@ -448,8 +448,9 @@ openchannel2_hook_cb(struct openchannel2_payload *payload STEALS)
|
||||
}
|
||||
|
||||
/* dualopend dies? Remove dualopend ptr from payload */
|
||||
static void openchannel2_psbt_remove_dualopend(struct subd *dualopend,
|
||||
struct openchannel2_psbt_payload *payload)
|
||||
static void
|
||||
openchannel2_psbt_remove_dualopend(struct subd *dualopend,
|
||||
struct openchannel2_psbt_payload *payload)
|
||||
{
|
||||
assert(payload->dualopend == dualopend);
|
||||
payload->dualopend = NULL;
|
||||
@ -776,7 +777,8 @@ static void accepter_commit_received(struct subd *dualopend,
|
||||
payload->ld = ld;
|
||||
|
||||
if (peer_active_channel(uc->peer)) {
|
||||
uncommitted_channel_disconnect(uc, LOG_BROKEN, "already have active channel");
|
||||
uncommitted_channel_disconnect(uc, LOG_BROKEN,
|
||||
"already have active channel");
|
||||
goto failed;
|
||||
}
|
||||
|
||||
@ -800,12 +802,14 @@ static void accepter_commit_received(struct subd *dualopend,
|
||||
remote_upfront_shutdown_script);
|
||||
|
||||
if (!payload->rcvd->channel) {
|
||||
uncommitted_channel_disconnect(uc, LOG_BROKEN, "commit channel failed");
|
||||
uncommitted_channel_disconnect(uc, LOG_BROKEN,
|
||||
"commit channel failed");
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (pbase)
|
||||
wallet_penalty_base_add(ld->wallet, payload->rcvd->channel->dbid,
|
||||
wallet_penalty_base_add(ld->wallet,
|
||||
payload->rcvd->channel->dbid,
|
||||
pbase);
|
||||
|
||||
/* dualopend is going away! */
|
||||
@ -1176,10 +1180,11 @@ static void peer_tx_sigs_msg(struct subd *dualopend,
|
||||
}
|
||||
|
||||
|
||||
static struct command_result *json_openchannel_signed(struct command *cmd,
|
||||
const char *buffer,
|
||||
const jsmntok_t *obj UNNEEDED,
|
||||
const jsmntok_t *params)
|
||||
static struct command_result *
|
||||
json_openchannel_signed(struct command *cmd,
|
||||
const char *buffer,
|
||||
const jsmntok_t *obj UNNEEDED,
|
||||
const jsmntok_t *params)
|
||||
{
|
||||
struct wally_psbt *psbt;
|
||||
const struct wally_tx *wtx;
|
||||
|
@ -313,8 +313,9 @@ static void set_reserve(struct state *state, struct amount_sat funding_total)
|
||||
/* BOLT-fe0351ca2cea3105c4f2eb18c571afca9d21c85b #2
|
||||
*
|
||||
* The channel reserve is fixed at 1% of the total channel balance
|
||||
* rounded down (sum of `funding_satoshis` from `open_channel2` and `accept_channel2`)
|
||||
* or the `dust_limit_satoshis`, whichever is greater.
|
||||
* rounded down (sum of `funding_satoshis` from `open_channel2`
|
||||
* and `accept_channel2`) or the `dust_limit_satoshis`, whichever
|
||||
* is greater.
|
||||
*/
|
||||
reserve = amount_sat_div(funding_total, 100);
|
||||
|
||||
@ -1610,8 +1611,8 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
|
||||
* - if `signature` is incorrect:
|
||||
* - MUST fail the channel.
|
||||
*/
|
||||
if (!check_tx_sig(local_commit, 0, NULL, wscript, &state->their_funding_pubkey,
|
||||
&remote_sig)) {
|
||||
if (!check_tx_sig(local_commit, 0, NULL, wscript,
|
||||
&state->their_funding_pubkey, &remote_sig)) {
|
||||
/* BOLT #1:
|
||||
*
|
||||
* ### The `error` Message
|
||||
@ -1627,14 +1628,16 @@ static u8 *accepter_start(struct state *state, const u8 *oc2_msg)
|
||||
* longer read C code. */
|
||||
peer_failed(state->pps,
|
||||
&state->channel_id,
|
||||
"Bad signature %s on tx %s using key %s (funding txid %s, psbt %s)",
|
||||
"Bad signature %s on tx %s using key %s"
|
||||
" (funding txid %s, psbt %s)",
|
||||
type_to_string(tmpctx, struct bitcoin_signature,
|
||||
&remote_sig),
|
||||
type_to_string(tmpctx, struct bitcoin_tx, local_commit),
|
||||
type_to_string(tmpctx, struct bitcoin_tx,
|
||||
local_commit),
|
||||
type_to_string(tmpctx, struct pubkey,
|
||||
&state->their_funding_pubkey),
|
||||
/* This is the first place we'd discover the funding tx
|
||||
* doesn't match up */
|
||||
/* This is the first place we'd discover
|
||||
* the funding tx doesn't match up */
|
||||
type_to_string(tmpctx, struct bitcoin_txid,
|
||||
&state->funding_txid),
|
||||
type_to_string(tmpctx, struct wally_psbt,
|
||||
@ -1725,12 +1728,12 @@ static u8 *opener_start(struct state *state, u8 *msg)
|
||||
u32 feerate_min, feerate_max, feerate_best;
|
||||
|
||||
if (!fromwire_dualopend_opener_init(state, msg,
|
||||
&psbt,
|
||||
&state->opener_funding,
|
||||
&state->upfront_shutdown_script[LOCAL],
|
||||
&state->feerate_per_kw_commitment,
|
||||
&state->feerate_per_kw_funding,
|
||||
&channel_flags))
|
||||
&psbt,
|
||||
&state->opener_funding,
|
||||
&state->upfront_shutdown_script[LOCAL],
|
||||
&state->feerate_per_kw_commitment,
|
||||
&state->feerate_per_kw_funding,
|
||||
&channel_flags))
|
||||
master_badmsg(WIRE_DUALOPEND_OPENER_INIT, msg);
|
||||
|
||||
state->our_role = TX_INITIATOR;
|
||||
@ -2080,14 +2083,16 @@ static u8 *opener_start(struct state *state, u8 *msg)
|
||||
* longer read C code. */
|
||||
peer_failed(state->pps,
|
||||
&state->channel_id,
|
||||
"Bad signature %s on tx %s using key %s (funding txid %s, psbt %s)",
|
||||
"Bad signature %s on tx %s using key %s "
|
||||
"(funding txid %s, psbt %s)",
|
||||
type_to_string(tmpctx, struct bitcoin_signature,
|
||||
&remote_sig),
|
||||
type_to_string(tmpctx, struct bitcoin_tx, local_commit),
|
||||
type_to_string(tmpctx, struct bitcoin_tx,
|
||||
local_commit),
|
||||
type_to_string(tmpctx, struct pubkey,
|
||||
&state->their_funding_pubkey),
|
||||
/* This is the first place we'd discover the funding tx
|
||||
* doesn't match up */
|
||||
/* This is the first place we'd discover the
|
||||
* funding tx doesn't match up */
|
||||
type_to_string(tmpctx, struct bitcoin_txid,
|
||||
&state->funding_txid),
|
||||
type_to_string(tmpctx, struct wally_psbt,
|
||||
|
Loading…
Reference in New Issue
Block a user