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

Function channel_for_splice

lightningd/channel_control.c:2256–2292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2254}
2255
2256static struct command_result *channel_for_splice(struct command *cmd,
2257 struct channel_id *cid,
2258 struct channel **channel)
2259{
2260 *channel = channel_by_cid(cmd->ld, cid);
2261 if (!*channel)
2262 return command_fail(cmd, SPLICE_UNKNOWN_CHANNEL,
2263 "Unknown channel %s",
2264 fmt_channel_id(tmpctx, cid));
2265
2266 if (!feature_negotiated(cmd->ld->our_features,
2267 (*channel)->peer->their_features,
2268 OPT_SPLICE))
2269 return command_fail(cmd, SPLICE_NOT_SUPPORTED,
2270 "Peer does not support splicing");
2271
2272 if (!(*channel)->owner)
2273 return command_fail(cmd, SPLICE_WRONG_OWNER,
2274 "Channel is disconnected");
2275
2276 if (!streq((*channel)->owner->name, "channeld"))
2277 return command_fail(cmd,
2278 SPLICE_WRONG_OWNER,
2279 "Channel hasn't finished connecting or in "
2280 "abnormal owner state %s",
2281 (*channel)->owner->name);
2282
2283 if ((*channel)->state != CHANNELD_NORMAL
2284 && (*channel)->state != CHANNELD_AWAITING_SPLICE)
2285 return command_fail(cmd,
2286 SPLICE_INVALID_CHANNEL_STATE,
2287 "Channel needs to be in normal or awaiting"
2288 " splice state but is in state %s",
2289 channel_state_name(*channel));
2290
2291 return NULL;
2292}
2293
2294static struct command_result *param_channel_for_splice(struct command *cmd,
2295 const char *name,

Callers 2

param_channel_for_spliceFunction · 0.85
json_splice_signedFunction · 0.85

Calls 5

feature_negotiatedFunction · 0.85
channel_by_cidFunction · 0.70
command_failFunction · 0.70
channel_state_nameFunction · 0.70
fmt_channel_idFunction · 0.50

Tested by

no test coverage detected