| 3447 | }; |
| 3448 | |
| 3449 | static 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 | |
| 3471 | static const struct plugin_notification notifications[] = { |
| 3472 | { |
nothing calls this directly
no test coverage detected