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

Function payment_getblockheight_success

plugins/libplugin-pay.c:303–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303static struct command_result *
304payment_getblockheight_success(struct command *cmd,
305 const char *method,
306 const char *buffer,
307 const jsmntok_t *toks,
308 struct payment *p)
309{
310 struct out_req *req;
311 u32 blockcount, headercount;
312
313 json_scan(tmpctx, buffer, toks, "{blockcount:%,headercount:%}",
314 JSON_SCAN(json_to_u32, &blockcount),
315 JSON_SCAN(json_to_u32, &headercount));
316 paymod_log(p, LOG_DBG,
317 "Received getchaininfo blockcount=%d, headercount=%d",
318 blockcount, headercount);
319
320 p->start_block = headercount;
321
322 /* Now we just need to ask `lightningd` what height it has
323 * synced up to, and we remember that as chainlag. */
324 req = jsonrpc_request_start(cmd, "waitblockheight",
325 &payment_waitblockheight_cb,
326 &payment_rpc_failure, p);
327 json_add_u32(req->js, "blockheight", 0);
328 return send_outreq(req);
329}
330
331#define INVALID_BLOCKHEIGHT UINT32_MAX
332

Callers

nothing calls this directly

Calls 4

paymod_logFunction · 0.85
json_add_u32Function · 0.85
send_outreqFunction · 0.70
json_scanFunction · 0.50

Tested by

no test coverage detected