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

Function main

closingd/closingd.c:859–1117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

857}
858
859int main(int argc, char *argv[])
860{
861 setup_locale();
862
863 const tal_t *ctx = tal(NULL, char);
864 struct per_peer_state *pps;
865 u8 *msg;
866 struct pubkey funding_pubkey[NUM_SIDES];
867 struct bitcoin_txid closing_txid;
868 struct bitcoin_outpoint funding;
869 struct amount_sat funding_sats, out[NUM_SIDES];
870 struct amount_sat our_dust_limit;
871 struct amount_sat min_fee_to_accept, commitment_fee, offer[NUM_SIDES],
872 max_fee_to_accept;
873 u32 min_feerate, initial_feerate, *max_feerate;
874 struct feerange feerange;
875 enum side opener;
876 u32 *local_wallet_index;
877 struct ext_key *local_wallet_ext_key;
878 u8 *scriptpubkey[NUM_SIDES], *funding_wscript;
879 u64 fee_negotiation_step;
880 u8 fee_negotiation_step_unit;
881 char fee_negotiation_step_str[32]; /* fee_negotiation_step + "sat" */
882 struct channel_id channel_id;
883 enum side whose_turn;
884 bool use_quickclose;
885 struct tlv_closing_signed_tlvs_fee_range *our_feerange, **their_feerange;
886 struct bitcoin_outpoint *wrong_funding;
887
888 subdaemon_setup(argc, argv);
889
890 status_setup_sync(REQ_FD);
891
892 msg = wire_sync_read(tmpctx, REQ_FD);
893 if (!fromwire_closingd_init(ctx, msg,
894 &chainparams,
895 &channel_id,
896 &funding,
897 &funding_sats,
898 &funding_pubkey[LOCAL],
899 &funding_pubkey[REMOTE],
900 &opener,
901 &out[LOCAL],
902 &out[REMOTE],
903 &our_dust_limit,
904 &min_feerate, &initial_feerate, &max_feerate,
905 &commitment_fee,
906 &local_wallet_index,
907 &local_wallet_ext_key,
908 &scriptpubkey[LOCAL],
909 &scriptpubkey[REMOTE],
910 &fee_negotiation_step,
911 &fee_negotiation_step_unit,
912 &use_quickclose,
913 &wrong_funding))
914 master_badmsg(WIRE_CLOSINGD_INIT, msg);
915
916 /* stdin == requests, 3 == peer, 4 = hsmd */

Callers

nothing calls this directly

Calls 15

setup_localeFunction · 0.85
new_per_peer_stateFunction · 0.85
per_peer_state_set_fdFunction · 0.85
bitcoin_redeem_2of2Function · 0.85
calc_fee_boundsFunction · 0.85
send_offerFunction · 0.85
receive_offerFunction · 0.85
do_quickcloseFunction · 0.85
init_feerangeFunction · 0.85
adjust_feerangeFunction · 0.85
adjust_offerFunction · 0.85

Tested by

no test coverage detected