| 467 | } |
| 468 | |
| 469 | static struct command_result *send_peers_scb(struct command *cmd, |
| 470 | struct node_id *nodeid) |
| 471 | { |
| 472 | const struct chanbackup *cb = chanbackup(cmd->plugin); |
| 473 | struct peer_backup *pb; |
| 474 | struct out_req *req; |
| 475 | const u8 *msg; |
| 476 | |
| 477 | if (!cb->handle_their_peer_backup) |
| 478 | return command_hook_success(cmd); |
| 479 | |
| 480 | /* Now send their backup, if any. */ |
| 481 | pb = backup_map_get(cb->backups, nodeid); |
| 482 | if (!pb || tal_bytelen(pb->data) == 0) |
| 483 | return command_hook_success(cmd); |
| 484 | |
| 485 | msg = towire_peer_storage_retrieval(cmd, pb->data); |
| 486 | |
| 487 | plugin_log(cmd->plugin, LOG_DBG, |
| 488 | "sending their backup from our datastore"); |
| 489 | |
| 490 | req = jsonrpc_request_start(cmd, |
| 491 | "sendcustommsg", |
| 492 | peer_after_send_their_peer_strg, |
| 493 | peer_after_send_their_peer_strg_err, |
| 494 | nodeid); |
| 495 | |
| 496 | json_add_node_id(req->js, "node_id", nodeid); |
| 497 | json_add_hex_talarr(req->js, "msg", msg); |
| 498 | |
| 499 | return send_outreq(req); |
| 500 | } |
| 501 | |
| 502 | static struct command_result *peer_after_send_scb(struct command *cmd, |
| 503 | const char *method, |
no test coverage detected