Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsonrpc: Remove the old "_msat" prefix in the listpeerchannels command #6245

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,18 +486,6 @@ static void json_add_htlcs(struct lightningd *ld,
json_array_end(response);
}

/* We do this replication manually because it's an array. */
static void json_add_sat_only(struct json_stream *result,
const char *fieldname,
struct amount_sat sat)
{
struct amount_msat msat;

if (amount_sat_to_msat(&msat, sat))
json_add_string(result, fieldname,
type_to_string(tmpctx, struct amount_msat, &msat));
}

/* Fee a commitment transaction would currently cost */
static struct amount_sat commit_txfee(const struct channel *channel,
struct amount_msat amount,
Expand Down Expand Up @@ -900,15 +888,15 @@ static void json_add_channel(struct lightningd *ld,
"Overflow adding our_funds to push");
total = channel->our_funds;
}
json_add_sat_only(response, "local_funds_msat", total);
json_add_amount_sat_msat(response, "local_funds_msat", total);

if (!amount_sat_sub(&total, peer_funded_sats, funds)) {
log_broken(channel->log,
"Underflow sub'ing push from"
" peer's funds");
total = peer_funded_sats;
}
json_add_sat_only(response, "remote_funds_msat", total);
json_add_amount_sat_msat(response, "remote_funds_msat", total);

json_add_amount_msat(response, "fee_paid_msat",
channel->push);
Expand All @@ -918,23 +906,23 @@ static void json_add_channel(struct lightningd *ld,
"Overflow adding peer funds to push");
total = peer_funded_sats;
}
json_add_sat_only(response, "remote_funds_msat", total);
json_add_amount_sat_msat(response, "remote_funds_msat", total);

if (!amount_sat_sub(&total, channel->our_funds, funds)) {
log_broken(channel->log,
"Underflow sub'ing push from"
" our_funds");
total = channel->our_funds;
}
json_add_sat_only(response, "local_funds_msat", total);
json_add_amount_sat_msat(response, "local_funds_msat", total);
json_add_amount_msat(response, "fee_rcvd_msat",
channel->push);
}

} else {
json_add_sat_only(response, "local_funds_msat",
json_add_amount_sat_msat(response, "local_funds_msat",
channel->our_funds);
json_add_sat_only(response, "remote_funds_msat",
json_add_amount_sat_msat(response, "remote_funds_msat",
peer_funded_sats);
json_add_amount_msat(response, "pushed_msat",
channel->push);
Expand Down