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

Function opt_force_channel_secrets

lightningd/options.c:670–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

668}
669
670static char *opt_force_channel_secrets(const char *optarg,
671 struct lightningd *ld)
672{
673 char **strs;
674 tal_free(ld->dev_force_channel_secrets);
675 tal_free(ld->dev_force_channel_secrets_shaseed);
676 ld->dev_force_channel_secrets = tal(ld, struct secrets);
677 ld->dev_force_channel_secrets_shaseed = tal(ld, struct sha256);
678
679 strs = tal_strsplit(tmpctx, optarg, "/", STR_EMPTY_OK);
680 if (tal_count(strs) != 7) /* Last is NULL */
681 return "Expected 6 hex secrets separated by /";
682
683 if (!hex_decode(strs[0], strlen(strs[0]),
684 &ld->dev_force_channel_secrets->funding_privkey,
685 sizeof(ld->dev_force_channel_secrets->funding_privkey))
686 || !hex_decode(strs[1], strlen(strs[1]),
687 &ld->dev_force_channel_secrets->revocation_basepoint_secret,
688 sizeof(ld->dev_force_channel_secrets->revocation_basepoint_secret))
689 || !hex_decode(strs[2], strlen(strs[2]),
690 &ld->dev_force_channel_secrets->payment_basepoint_secret,
691 sizeof(ld->dev_force_channel_secrets->payment_basepoint_secret))
692 || !hex_decode(strs[3], strlen(strs[3]),
693 &ld->dev_force_channel_secrets->delayed_payment_basepoint_secret,
694 sizeof(ld->dev_force_channel_secrets->delayed_payment_basepoint_secret))
695 || !hex_decode(strs[4], strlen(strs[4]),
696 &ld->dev_force_channel_secrets->htlc_basepoint_secret,
697 sizeof(ld->dev_force_channel_secrets->htlc_basepoint_secret))
698 || !hex_decode(strs[5], strlen(strs[5]),
699 ld->dev_force_channel_secrets_shaseed,
700 sizeof(*ld->dev_force_channel_secrets_shaseed)))
701 return "Expected 6 hex secrets separated by /";
702
703 return NULL;
704}
705
706static char *opt_force_featureset(const char *optarg,
707 struct lightningd *ld)

Callers

nothing calls this directly

Calls 2

tal_freeFunction · 0.85
hex_decodeFunction · 0.85

Tested by

no test coverage detected