| 301 | } |
| 302 | |
| 303 | static struct command_result * |
| 304 | payment_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 |
nothing calls this directly
no test coverage detected