| 2662 | AUTODATA(json_command, &listpeers_command); |
| 2663 | |
| 2664 | static void json_add_scb(struct command *cmd, |
| 2665 | const char *fieldname, |
| 2666 | struct json_stream *response, |
| 2667 | struct channel *c) |
| 2668 | { |
| 2669 | u8 *scb_wire = tal_arr(cmd, u8, 0); |
| 2670 | struct modern_scb_chan *scb; |
| 2671 | |
| 2672 | /* Don't do scb for unix domain sockets. */ |
| 2673 | if (c->peer->addr.itype != ADDR_INTERNAL_WIREADDR) |
| 2674 | return; |
| 2675 | |
| 2676 | scb = tal(tmpctx, struct modern_scb_chan); |
| 2677 | scb->id = c->dbid; |
| 2678 | /* More useful to have last_known_addr, if avail */ |
| 2679 | if (c->peer->last_known_addr) |
| 2680 | scb->addr = *c->peer->last_known_addr; |
| 2681 | else |
| 2682 | scb->addr = c->peer->addr.u.wireaddr.wireaddr; |
| 2683 | scb->node_id = c->peer->id; |
| 2684 | scb->funding = c->funding; |
| 2685 | scb->cid = c->cid; |
| 2686 | scb->funding_sats = c->funding_sats; |
| 2687 | scb->type = channel_type_dup(scb, c->type); |
| 2688 | |
| 2689 | scb->tlvs = tlv_scb_tlvs_new(scb); |
| 2690 | scb->tlvs->shachain = &c->their_shachain.chain; |
| 2691 | scb->tlvs->basepoints = &c->channel_info.theirbase; |
| 2692 | scb->tlvs->opener = &c->opener; |
| 2693 | scb->tlvs->remote_to_self_delay = &c->channel_info.their_config.to_self_delay; |
| 2694 | |
| 2695 | towire_modern_scb_chan(&scb_wire, scb); |
| 2696 | |
| 2697 | json_add_hex_talarr(response, fieldname, scb_wire); |
| 2698 | } |
| 2699 | |
| 2700 | /* This will return a SCB for all the channels currently loaded |
| 2701 | * in the in-memory channel */ |
no test coverage detected