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

Function main

devtools/mkcommit.c:244–641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244int main(int argc, char *argv[])
245{
246 struct secrets local, remote;
247 struct sha256 localseed, remoteseed;
248 struct basepoints localbase, remotebase;
249 struct pubkey funding_localkey, funding_remotekey;
250 u64 commitnum;
251 struct amount_sat funding_amount;
252 struct channel_id cid;
253 struct bitcoin_outpoint funding;
254 u32 feerate_per_kw;
255 struct pubkey local_per_commit_point, remote_per_commit_point;
256 struct bitcoin_signature local_sig, remote_sig;
257 struct channel_config localconfig, remoteconfig;
258 struct amount_msat local_msat, remote_msat;
259 int argnum;
260 struct bitcoin_tx **local_txs, **remote_txs;
261 enum side fee_payer;
262 u8 **witness;
263 const u8 *funding_wscript;
264 struct channel *channel;
265 struct existing_htlc **htlcs = tal_arr(NULL, struct existing_htlc *, 0);
266 const struct htlc **htlcmap;
267 struct privkey local_htlc_privkey, remote_htlc_privkey;
268 struct pubkey local_htlc_pubkey, remote_htlc_pubkey;
269 bool option_static_remotekey = false, option_anchor_outputs = false;
270 const struct channel_type *channel_type;
271 struct sha256_double hash;
272 u32 blockheight = 0;
273
274 setup_locale();
275 chainparams = chainparams_for_network("bitcoin");
276
277 secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY |
278 SECP256K1_CONTEXT_SIGN);
279
280 opt_register_noarg("--help|-h", opt_usage_and_exit,
281 "<commitnum> <funding-txid> <funding-txout> <funding-amount> <feerate-per-kw> <local-msat> <fee-payer> <localconfig> <remoteconfig> <localsecrets> <remotesecrets> [<htlc>...]\n"
282 "Where <config> are:\n"
283 " <to-self-delay>\n"
284 " <dustlimit>\n"
285 " <reserve-sat>\n"
286 "Where <secrets> are:\n"
287 " <funding-privkey>\n"
288 " <shachain-seed>\n"
289 " <revocation-base-secret>\n"
290 " <payment-base-secret>\n"
291 " <delayed-payment-base-secret>\n"
292 " <htlc-base-secret>\n"
293 "Where <htlc>s are:\n"
294 " <offer-side>\n"
295 " <payment-preimage>\n"
296 " <amount-msat>\n"
297 " <cltv-expiry>\n",
298 "Show this message");
299 opt_register_noarg("-v|--verbose", opt_set_bool, &verbose,
300 "Increase verbosity");
301 opt_register_noarg("--option-static-remotekey", opt_set_bool,

Callers

nothing calls this directly

Calls 15

setup_localeFunction · 0.85
chainparams_for_networkFunction · 0.85
opt_parseFunction · 0.85
opt_usage_exit_failFunction · 0.85
bitcoin_txid_from_hexFunction · 0.85
errxFunction · 0.85
parse_configFunction · 0.85
parse_secretsFunction · 0.85
amount_sat_sub_msatFunction · 0.85
parse_htlcFunction · 0.85
pubkey_from_privkeyFunction · 0.85
pubkey_from_secretFunction · 0.85

Tested by

no test coverage detected