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

Function send_peers_scb

plugins/chanbackup.c:469–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467}
468
469static 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
502static struct command_result *peer_after_send_scb(struct command *cmd,
503 const char *method,

Callers 2

peer_after_send_scbFunction · 0.85
peer_connectedFunction · 0.85

Calls 7

tal_bytelenFunction · 0.85
json_add_node_idFunction · 0.85
json_add_hex_talarrFunction · 0.85
chanbackupFunction · 0.70
command_hook_successFunction · 0.70
plugin_logFunction · 0.70
send_outreqFunction · 0.70

Tested by

no test coverage detected