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

Function json_add_scb

lightningd/peer_control.c:2938–2972  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2936AUTODATA(json_command, &listpeers_command);
2937
2938static void json_add_scb(struct command *cmd,
2939 const char *fieldname,
2940 struct json_stream *response,
2941 struct channel *c)
2942{
2943 u8 *scb_wire = tal_arr(cmd, u8, 0);
2944 struct modern_scb_chan *scb;
2945
2946 /* Don't do scb for unix domain sockets. */
2947 if (c->peer->addr.itype != ADDR_INTERNAL_WIREADDR)
2948 return;
2949
2950 scb = tal(tmpctx, struct modern_scb_chan);
2951 scb->id = c->dbid;
2952 /* More useful to have last_known_addr, if avail */
2953 if (c->peer->last_known_addr)
2954 scb->addr = *c->peer->last_known_addr;
2955 else
2956 scb->addr = c->peer->addr.u.wireaddr.wireaddr;
2957 scb->node_id = c->peer->id;
2958 scb->funding = c->funding;
2959 scb->cid = c->cid;
2960 scb->funding_sats = c->funding_sats;
2961 scb->type = channel_type_dup(scb, c->type);
2962
2963 scb->tlvs = tlv_scb_tlvs_new(scb);
2964 scb->tlvs->shachain = &c->their_shachain.chain;
2965 scb->tlvs->basepoints = &c->channel_info.theirbase;
2966 scb->tlvs->opener = &c->opener;
2967 scb->tlvs->remote_to_self_delay = &c->channel_info.their_config.to_self_delay;
2968
2969 towire_modern_scb_chan(&scb_wire, scb);
2970
2971 json_add_hex_talarr(response, fieldname, scb_wire);
2972}
2973
2974/* This will return a SCB for all the channels currently loaded
2975 * in the in-memory channel */

Callers 1

json_staticbackupFunction · 0.85

Calls 2

channel_type_dupFunction · 0.85
json_add_hex_talarrFunction · 0.85

Tested by

no test coverage detected