runes: create and blacklist commands aliases

- Added `invokerune` alias for `createrune`
- Added `destroyrune` alias for `blacklistrune`
This commit is contained in:
Shahana Farooqui 2023-07-25 09:33:28 +09:30 committed by Rusty Russell
parent f5bac83232
commit a649e8b517
3 changed files with 21 additions and 0 deletions

View file

@ -11,6 +11,8 @@ DESCRIPTION
The **blacklistrune** RPC command allows you to effectively revoke the rune you have created (and any runes derived from that rune with additional restictions). Attempting to use these runes will be resulted in a `Blacklisted rune` error message.
Destroy a rune like in olden times with the **destroyrune** command.
All runes created by lightning have a unique sequential id within them and can be blacklisted in ranges for efficiency. The command always returns the blacklisted ranges on success. If no parameters are specified, no changes have been made. If start specified without end, that single rune is blacklisted. If end is also specified, every rune from start till end inclusive is blacklisted.
RETURN VALUE

View file

@ -17,6 +17,9 @@ you try, the rune will be rejected. There is no limit on how many
runes you can issue; the node simply decodes and checks them as they are
received.
Oh, I almost forgot. Runes can also be invoked like in ancient times with
the **invokerune** command. Feel the magical powers of a rune by invoking it.
If *rune* is supplied, the restrictions are simple appended to that
*rune* (it doesn't need to be a rune belonging to this node). If no
*rune* is supplied, a new one is constructed, with a new unique id.

View file

@ -535,6 +535,14 @@ static const struct json_command creatrune_command = {
};
AUTODATA(json_command, &creatrune_command);
static const struct json_command invokerune_command = {
"invokerune",
"utility",
json_createrune,
"Invoke or restrict an optional {rune} with optional {restrictions} and returns {rune}"
};
AUTODATA(json_command, &invokerune_command);
static void blacklist_merge(struct rune_blacklist *blacklist,
const struct rune_blacklist *entry)
{
@ -636,6 +644,14 @@ static const struct json_command blacklistrune_command = {
};
AUTODATA(json_command, &blacklistrune_command);
static const struct json_command destroyrune_command = {
"destroyrune",
"utility",
json_blacklistrune,
"Destroy a rune or range of runes by taking an optional {start} and an optional {end} and returns {blacklist} array containing {start}, {end}"
};
AUTODATA(json_command, &destroyrune_command);
static const char *check_condition(const tal_t *ctx,
const struct rune *rune,
const struct rune_altern *alt,