Skip to content

Commit

Permalink
offer: fix type to the getchaininfo rpc
Browse files Browse the repository at this point in the history
This is violate what the docs of getchainfo is telling us that the
last_block_height is a u64.

```
2024-05-17T09:53:23.464Z **BROKEN** plugin-offers: Got error reply to getchaininfo: '{\"error\":{\"code\":-1,\"data\":null,\"message\":\"invalid type: string \\\"0\\\", expected u64\"},\"id\":\"init/offers:getchaininfo#1\",\"jsonrpc\":\"2.0\"}\n\n'
2024-05-17T09:53:23.496Z INFO    plugin-offers: Killing plugin: exited before replying to init
2024-05-17T09:53:23.496Z **BROKEN** plugin-offers: Plugin marked as important, shutting down lightningd!
2024-05-17T09:53:23.496Z DEBUG   lightningd: io_break: lightningd_exit
2024-05-17T09:53:23.496Z **BROKEN** plugin-topology: Reading JSON input: Connection reset by peer
2024-05-17T09:53:23.504Z INFO    plugin-topology: Killing plugin: exited before replying to init
2024-05-17T09:53:23.504Z **BROKEN** plugin-topology: Plugin marked as important, shutting down lightningd!
2024-05-17T09:53:23.504Z DEBUG   lightningd: io_break: lightningd_exit
2024-05-17T09:53:23.504Z DEBUG   plugin-bookkeeper: Setting up database at sqlite3://accounts.sqlite3
2024-05-17T09:53:23.504Z DEBUG   connectd: REPLY WIRE_CONNECTD_START_SHUTDOWN_REPLY with 0 fds
2024-05-17T09:53:23.504Z DEBUG   lightningd: io_break: connectd_start_shutdown_reply
```

Fixing the following crash

```
Got error reply to getchaininfo: '{"error":{"code":-1,"data":null,"message":"invalid type: string \"0\", expected u64"},"id":"init/offers:getchaininfo#1","jsonrpc":"2.0"}

'lightningd: lightningd already running? Error locking PID file: Resource temporarily unavailable
```

Fixes: 847208f
Changelog-None: offer: fix type to the getchaininfo rpc
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo authored and endothermicdev committed May 22, 2024
1 parent 4b4516c commit fbecefe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/offers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ static const char *init(struct plugin *p,
"{id:%}", JSON_SCAN(json_to_pubkey, &id));

rpc_scan(p, "getchaininfo",
take(json_out_obj(NULL, "last_height", "0")),
take(json_out_obj(NULL, "last_height", NULL)),
"{headercount:%}", JSON_SCAN(json_to_u32, &blockheight));
assert(blockheight);

Expand Down

0 comments on commit fbecefe

Please sign in to comment.