MCPcopy Create free account
hub / github.com/ElementsProject/lightning / handle_block_added

Function handle_block_added

plugins/xpay/xpay.c:3449–3469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3447};
3448
3449static struct command_result *handle_block_added(struct command *cmd,
3450 const char *buf,
3451 const jsmntok_t *params)
3452{
3453 struct xpay *xpay = xpay_of(cmd->plugin);
3454 u32 blockheight;
3455 const char *err;
3456
3457 err = json_scan(tmpctx, buf, params,
3458 "{block_added:{height:%}}",
3459 JSON_SCAN(json_to_u32, &blockheight));
3460 if (err)
3461 plugin_err(cmd->plugin, "Bad block_added notification: %s",
3462 err);
3463
3464 /* If we were using header height, we might not have passed it yet */
3465 if (blockheight > xpay->blockheight)
3466 xpay->blockheight = blockheight;
3467
3468 return notification_handled(cmd);
3469}
3470
3471static const struct plugin_notification notifications[] = {
3472 {

Callers

nothing calls this directly

Calls 4

xpay_ofFunction · 0.85
json_scanFunction · 0.50
plugin_errFunction · 0.50
notification_handledFunction · 0.50

Tested by

no test coverage detected