| 3308 | direct_pay_cb); |
| 3309 | |
| 3310 | static struct command_result *waitblockheight_rpc_cb(struct command *cmd, |
| 3311 | const char *buffer, |
| 3312 | const jsmntok_t *toks, |
| 3313 | struct payment *p) |
| 3314 | { |
| 3315 | const jsmntok_t *blockheighttok, *codetok; |
| 3316 | |
| 3317 | u32 blockheight; |
| 3318 | int code; |
| 3319 | struct payment *subpayment; |
| 3320 | |
| 3321 | blockheighttok = json_get_member(buffer, toks, "blockheight"); |
| 3322 | |
| 3323 | if (!blockheighttok || |
| 3324 | !json_to_number(buffer, blockheighttok, &blockheight)) { |
| 3325 | codetok = json_get_member(buffer, toks, "code"); |
| 3326 | json_to_int(buffer, codetok, &code); |
| 3327 | if (code == WAIT_TIMEOUT) { |
| 3328 | payment_fail( |
| 3329 | p, |
| 3330 | "Timed out while attempting to sync to blockheight " |
| 3331 | "returned by destination. Please finish syncing " |
| 3332 | "with the blockchain and try again."); |
| 3333 | |
| 3334 | } else { |
| 3335 | plugin_err( |
| 3336 | p->plugin, |
| 3337 | "Unexpected result from waitblockheight: %.*s", |
| 3338 | json_tok_full_len(toks), |
| 3339 | json_tok_full(buffer, toks)); |
| 3340 | } |
| 3341 | } else { |
| 3342 | subpayment = payment_new(p, NULL, p, p->modifiers); |
| 3343 | payment_start_at_blockheight(subpayment, blockheight); |
| 3344 | payment_set_step(p, PAYMENT_STEP_RETRY); |
| 3345 | subpayment->why = tal_fmt( |
| 3346 | subpayment, "Retrying after waiting for blockchain sync."); |
| 3347 | paymod_log( |
| 3348 | p, LOG_DBG, |
| 3349 | "Retrying after waitblockheight, new partid %" PRIu32, |
| 3350 | subpayment->partid); |
| 3351 | payment_continue(p); |
| 3352 | } |
| 3353 | return command_still_pending(cmd); |
| 3354 | } |
| 3355 | |
| 3356 | static void waitblockheight_cb(void *d, struct payment *p) |
| 3357 | { |
nothing calls this directly
no test coverage detected