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

Post v22.11 deprecation removals #5747

Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions common/shutdown_scriptpubkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ static bool is_valid_witnessprog(const u8 *scriptpubkey)

bool valid_shutdown_scriptpubkey(const u8 *scriptpubkey,
bool anysegwit,
bool anchors)
bool allow_oldstyle)
{
if (!anchors) {
if (allow_oldstyle) {
if (is_p2pkh(scriptpubkey, NULL)
|| is_p2sh(scriptpubkey, NULL))
return true;
Expand Down
5 changes: 4 additions & 1 deletion common/shutdown_scriptpubkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
* - if the `scriptpubkey` is not in one of the above forms:
* - SHOULD send a `warning`
*/

/* We still allow them to specify an old-style P2PKH or P2SH (though we
* never will send such a thing!) if they're not using anchors. */
bool valid_shutdown_scriptpubkey(const u8 *scriptpubkey,
bool anysegwit,
bool anchors);
bool allow_oldstyle);

#endif /* LIGHTNING_COMMON_SHUTDOWN_SCRIPTPUBKEY_H */
1 change: 0 additions & 1 deletion contrib/msggen/msggen/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def load_jsonrpc_service(schema_dir: str):
# "sendcustommsg",
# "sendinvoice",
# "sendonionmessage",
# "setchannelfee",
"SetChannel",
"SignMessage",
# "unreserveinputs",
Expand Down
14 changes: 0 additions & 14 deletions contrib/pyln-client/pyln/client/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,20 +1259,6 @@ def sendonion(
}
return self.call("sendonion", payload)

def setchannelfee(self, id, base=None, ppm=None, enforcedelay=None):
"""
Set routing fees for a channel/peer {id} (or 'all'). {base} is a value in millisatoshi
that is added as base fee to any routed payment. {ppm} is a value added proportionally
per-millionths to any routed payment volume in satoshi. {enforcedelay} is the number of seconds before enforcing this change.
"""
payload = {
"id": id,
"base": base,
"ppm": ppm,
"enforcedelay": enforcedelay,
}
return self.call("setchannelfee", payload)

def setchannel(self, id, feebase=None, feeppm=None, htlcmin=None, htlcmax=None, enforcedelay=None):
"""Set configuration a channel/peer {id} (or 'all').

Expand Down
1 change: 0 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ MANPAGES := doc/lightning-cli.1 \
doc/lightning-sendonionmessage.7 \
doc/lightning-sendpay.7 \
doc/lightning-setchannel.7 \
doc/lightning-setchannelfee.7 \
doc/lightning-sendcustommsg.7 \
doc/lightning-signmessage.7 \
doc/lightning-staticbackup.7 \
Expand Down
1 change: 0 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ Core Lightning Documentation
lightning-sendpay <lightning-sendpay.7.md>
lightning-sendpsbt <lightning-sendpsbt.7.md>
lightning-setchannel <lightning-setchannel.7.md>
lightning-setchannelfee <lightning-setchannelfee.7.md>
lightning-signmessage <lightning-signmessage.7.md>
lightning-signpsbt <lightning-signpsbt.7.md>
lightning-staticbackup <lightning-staticbackup.7.md>
Expand Down
3 changes: 2 additions & 1 deletion doc/lightning-pay.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ implement your own heuristics rather than the primitive ones used
here.

*description* is only required for bolt11 invoices which do not
contain a description themselves, but contain a description hash.
contain a description themselves, but contain a description hash:
in this case *description* is required.
*description* is then checked against the hash inside the invoice
before it will be paid.

Expand Down
86 changes: 0 additions & 86 deletions doc/lightning-setchannelfee.7.md

This file was deleted.

2 changes: 1 addition & 1 deletion lightningd/channel_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static void peer_got_shutdown(struct channel *channel, const u8 *msg)
* - if the `scriptpubkey` is not in one of the above forms:
* - SHOULD send a `warning`.
*/
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit, anchors)) {
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit, !anchors)) {
u8 *warning = towire_warningfmt(NULL,
&channel->cid,
"Bad shutdown scriptpubkey %s",
Expand Down
4 changes: 2 additions & 2 deletions lightningd/closing_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,11 @@ static struct command_result *json_close(struct command *cmd,
channel->peer->their_features,
OPT_SHUTDOWN_ANYSEGWIT);
if (!valid_shutdown_scriptpubkey(channel->shutdown_scriptpubkey[LOCAL],
anysegwit, !deprecated_apis)) {
anysegwit, false)) {
/* Explicit check for future segwits. */
if (!anysegwit &&
valid_shutdown_scriptpubkey(channel->shutdown_scriptpubkey
[LOCAL], true, !deprecated_apis)) {
[LOCAL], true, false)) {
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"Peer does not allow v1+ shutdown addresses");
}
Expand Down
2 changes: 1 addition & 1 deletion lightningd/dual_open_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ static void handle_peer_wants_to_close(struct subd *dualopend,
* - if the `scriptpubkey` is not in one of the above forms:
* - SHOULD send a `warning`
*/
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit, anchors)) {
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit, !anchors)) {
u8 *warning = towire_warningfmt(NULL,
&channel->cid,
"Bad shutdown scriptpubkey %s",
Expand Down
52 changes: 1 addition & 51 deletions lightningd/invoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,56 +1018,6 @@ static struct command_result *param_positive_msat_or_any(struct command *cmd,
"should be positive msat or 'any'");
}

/* Parse time with optional suffix, return seconds */
static struct command_result *param_time(struct command *cmd, const char *name,
const char *buffer,
const jsmntok_t *tok,
uint64_t **secs)
{
/* We need to manipulate this, so make copy */
jsmntok_t timetok = *tok;
u64 mul;
char s;
struct {
char suffix;
u64 mul;
} suffixes[] = {
{ 's', 1 },
{ 'm', 60 },
{ 'h', 60*60 },
{ 'd', 24*60*60 },
{ 'w', 7*24*60*60 } };

if (!deprecated_apis)
return param_u64(cmd, name, buffer, tok, secs);

mul = 1;
if (timetok.end == timetok.start)
s = '\0';
else
s = buffer[timetok.end - 1];
for (size_t i = 0; i < ARRAY_SIZE(suffixes); i++) {
if (s == suffixes[i].suffix) {
mul = suffixes[i].mul;
timetok.end--;
break;
}
}

*secs = tal(cmd, uint64_t);
if (json_to_u64(buffer, &timetok, *secs)) {
if (mul_overflows_u64(**secs, mul)) {
return command_fail_badparam(cmd, name, buffer, tok,
"value too large");
}
**secs *= mul;
return NULL;
}

return command_fail_badparam(cmd, name, buffer, tok,
"should be a number");
}

static struct command_result *param_chanhints(struct command *cmd,
const char *name,
const char *buffer,
Expand Down Expand Up @@ -1153,7 +1103,7 @@ static struct command_result *json_invoice(struct command *cmd,
p_req("amount_msat|msatoshi", param_positive_msat_or_any, &msatoshi_val),
p_req("label", param_label, &info->label),
p_req("description", param_escaped_string, &desc_val),
p_opt_def("expiry", param_time, &expiry, 3600*24*7),
p_opt_def("expiry", param_u64, &expiry, 3600*24*7),
p_opt("fallbacks", param_array, &fallbacks),
p_opt("preimage", param_preimage, &preimage),
p_opt("exposeprivatechannels", param_chanhints,
Expand Down
4 changes: 0 additions & 4 deletions lightningd/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1354,10 +1354,6 @@ static struct command_result *param_route_hop_style(struct command *cmd,
return NULL;
}

/* We still let you *specify* this, but we ignore it! */
if (deprecated_apis && json_tok_streq(buffer, tok, "legacy"))
return NULL;

return command_fail_badparam(cmd, name, buffer, tok,
"should be 'tlv' ('legacy' not supported)");
}
Expand Down
72 changes: 0 additions & 72 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -2623,78 +2623,6 @@ static void set_channel_config(struct command *cmd, struct channel *channel,
json_object_end(response);
}

static struct command_result *json_setchannelfee(struct command *cmd,
const char *buffer,
const jsmntok_t *obj UNNEEDED,
const jsmntok_t *params)
{
struct json_stream *response;
struct peer *peer;
struct channel **channels;
u32 *base, *ppm, *delaysecs;

/* Parse the JSON command */
if (!param(cmd, buffer, params,
p_req("id", param_channel_or_all, &channels),
p_opt_def("base", param_msat_u32,
&base, cmd->ld->config.fee_base),
p_opt_def("ppm", param_number, &ppm,
cmd->ld->config.fee_per_satoshi),
/* BOLT #7:
* If it creates a new `channel_update` with updated channel parameters:
* - SHOULD keep accepting the previous channel parameters for 10 minutes
*/
p_opt_def("enforcedelay", param_number, &delaysecs, 600),
NULL))
return command_param_failed();

/* Open JSON response object for later iteration */
response = json_stream_success(cmd);
json_add_num(response, "base", *base);
json_add_num(response, "ppm", *ppm);
json_array_start(response, "channels");

/* If the users requested 'all' channels we need to iterate */
if (channels == NULL) {
list_for_each(&cmd->ld->peers, peer, list) {
struct channel *channel;
list_for_each(&peer->channels, channel, list) {
if (channel->state != CHANNELD_NORMAL &&
channel->state != CHANNELD_AWAITING_LOCKIN &&
channel->state != DUALOPEND_AWAITING_LOCKIN)
continue;
set_channel_config(cmd, channel, base, ppm, NULL, NULL,
*delaysecs, response, false);
}
}
/* single peer should be updated */
} else {
for (size_t i = 0; i < tal_count(channels); i++) {
set_channel_config(cmd, channels[i], base, ppm, NULL, NULL,
*delaysecs, response, false);
}
}

/* Close and return response */
json_array_end(response);
return command_success(cmd, response);
}

static const struct json_command setchannelfee_command = {
"setchannelfee",
"channels",
json_setchannelfee,
"Sets specific routing fees for channel with {id} "
"(either peer ID, channel ID, short channel ID or 'all'). "
"Routing fees are defined by a fixed {base} (msat) "
"and a {ppm} (proportional per millionth) value. "
"If values for {base} or {ppm} are left out, defaults will be used. "
"{base} can also be defined in other units, for example '1sat'. "
"If {id} is 'all', the fees will be applied for all channels. ",
true /* deprecated */
};
AUTODATA(json_command, &setchannelfee_command);

static struct command_result *json_setchannel(struct command *cmd,
const char *buffer,
const jsmntok_t *obj UNNEEDED,
Expand Down
2 changes: 1 addition & 1 deletion openingd/openingd.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static void set_remote_upfront_shutdown(struct state *state,
= tal_steal(state, shutdown_scriptpubkey);

if (shutdown_scriptpubkey
&& !valid_shutdown_scriptpubkey(shutdown_scriptpubkey, anysegwit, anchors))
&& !valid_shutdown_scriptpubkey(shutdown_scriptpubkey, anysegwit, !anchors))
peer_failed_err(state->pps,
&state->channel_id,
"Unacceptable upfront_shutdown_script %s",
Expand Down
2 changes: 1 addition & 1 deletion plugins/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ static struct command_result *json_pay(struct command *cmd,
* - MUST check that the SHA2 256-bit hash in the `h` field
* exactly matches the hashed description.
*/
if (!b11->description && !deprecated_apis) {
if (!b11->description) {
if (!b11->description_hash) {
return command_fail(cmd,
JSONRPC2_INVALID_PARAMS,
Expand Down
Loading