@@ -1516,6 +1516,7 @@ static unsigned channel_msg(struct subd *sd, const u8 *msg, const int *fds)
15161516 case WIRE_CHANNELD_DEV_MEMLEAK :
15171517 case WIRE_CHANNELD_DEV_QUIESCE :
15181518 case WIRE_CHANNELD_GOT_INFLIGHT :
1519+ case WIRE_CHANNELD_DEV_PEER_SHACHAIN :
15191520 /* Replies go to requests. */
15201521 case WIRE_CHANNELD_OFFER_HTLC_REPLY :
15211522 case WIRE_CHANNELD_DEV_REENABLE_COMMIT_REPLY :
@@ -2306,6 +2307,51 @@ static const struct json_command dev_feerate_command = {
23062307};
23072308AUTODATA (json_command , & dev_feerate_command );
23082309
2310+ static struct command_result * json_dev_peer_shachain (struct command * cmd ,
2311+ const char * buffer ,
2312+ const jsmntok_t * obj UNNEEDED ,
2313+ const jsmntok_t * params )
2314+ {
2315+ struct sha256 * shachain_seed ;
2316+ struct node_id * id ;
2317+ struct peer * peer ;
2318+ struct channel * channel ;
2319+ const u8 * msg ;
2320+ bool more_than_one ;
2321+
2322+ if (!param_check (cmd , buffer , params ,
2323+ p_req ("id" , param_node_id , & id ),
2324+ p_req ("seed" , param_sha256 , & shachain_seed ),
2325+ NULL ))
2326+ return command_param_failed ();
2327+
2328+ peer = peer_by_id (cmd -> ld , id );
2329+ if (!peer )
2330+ return command_fail (cmd , LIGHTNINGD , "Peer not connected" );
2331+
2332+ channel = peer_any_channel (peer , channel_state_can_add_htlc , & more_than_one );
2333+ if (!channel || !channel -> owner )
2334+ return command_fail (cmd , LIGHTNINGD , "Peer bad state" );
2335+ /* This is a dev command: fix the api if you need this! */
2336+ if (more_than_one )
2337+ return command_fail (cmd , LIGHTNINGD , "More than one channel" );
2338+
2339+ if (command_check_only (cmd ))
2340+ return command_check_done (cmd );
2341+
2342+ msg = towire_channeld_dev_peer_shachain (NULL , shachain_seed );
2343+ subd_send_msg (channel -> owner , take (msg ));
2344+
2345+ return command_success (cmd , json_stream_success (cmd ));
2346+ }
2347+
2348+ static const struct json_command dev_peer_shachain_command = {
2349+ "dev-peer-shachain" ,
2350+ json_dev_peer_shachain ,
2351+ .dev_only = true,
2352+ };
2353+ AUTODATA (json_command , & dev_peer_shachain_command );
2354+
23092355static void quiesce_reply (struct subd * channeld UNUSED ,
23102356 const u8 * reply ,
23112357 const int * fds UNUSED ,
0 commit comments