mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 09:34:24 +01:00
runes: fix stored field.
The uid isn't enough: it could be someone else's rune. This is tested in the command rune list tests. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -326,8 +326,11 @@ static struct command_result *json_showrunes(struct command *cmd,
|
||||
json_array_start(response, "runes");
|
||||
if (ras) {
|
||||
long uid = atol(ras->rune->unique_id);
|
||||
bool in_db = (wallet_get_rune(tmpctx, cmd->ld->wallet, uid) != NULL);
|
||||
json_add_rune(cmd->ld, response, NULL, ras->runestr, ras->rune, in_db);
|
||||
const char *from_db = wallet_get_rune(tmpctx, cmd->ld->wallet, uid);
|
||||
|
||||
/* We consider it stored iff this is exactly stored */
|
||||
json_add_rune(cmd->ld, response, NULL, ras->runestr, ras->rune,
|
||||
from_db && streq(from_db, ras->runestr));
|
||||
} else {
|
||||
const char **strs = wallet_get_runes(cmd, cmd->ld->wallet);
|
||||
for (size_t i = 0; i < tal_count(strs); i++) {
|
||||
|
||||
Reference in New Issue
Block a user