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

Function main

closingd/closingd.c:834–1105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

832}
833
834int main(int argc, char *argv[])
835{
836 setup_locale();
837
838 const tal_t *ctx = tal(NULL, char);
839 struct per_peer_state *pps;
840 u8 *msg;
841 struct pubkey funding_pubkey[NUM_SIDES];
842 struct bitcoin_txid closing_txid;
843 struct bitcoin_outpoint funding;
844 struct amount_sat funding_sats, out[NUM_SIDES];
845 struct amount_sat our_dust_limit;
846 struct amount_sat min_fee_to_accept, offer[NUM_SIDES],
847 max_fee_to_accept;
848 u32 min_feerate, initial_feerate, max_feerate;
849 struct feerange feerange;
850 enum side opener;
851 u32 *local_wallet_index;
852 struct ext_key *local_wallet_ext_key;
853 u8 *scriptpubkey[NUM_SIDES], *funding_wscript;
854 u64 fee_negotiation_step;
855 u8 fee_negotiation_step_unit;
856 char fee_negotiation_step_str[32]; /* fee_negotiation_step + "sat" */
857 struct channel_id channel_id;
858 enum side whose_turn;
859 bool use_quickclose;
860 struct tlv_closing_signed_tlvs_fee_range *our_feerange, **their_feerange;
861 struct bitcoin_outpoint *wrong_funding;
862 bool developer;
863
864 developer = subdaemon_setup(argc, argv);
865
866 status_setup_sync(REQ_FD);
867
868 msg = wire_sync_read(tmpctx, REQ_FD);
869 if (!fromwire_closingd_init(ctx, msg,
870 &chainparams,
871 &channel_id,
872 &funding,
873 &funding_sats,
874 &funding_pubkey[LOCAL],
875 &funding_pubkey[REMOTE],
876 &opener,
877 &out[LOCAL],
878 &out[REMOTE],
879 &our_dust_limit,
880 &min_feerate, &initial_feerate, &max_feerate,
881 &local_wallet_index,
882 &local_wallet_ext_key,
883 &scriptpubkey[LOCAL],
884 &scriptpubkey[REMOTE],
885 &fee_negotiation_step,
886 &fee_negotiation_step_unit,
887 &use_quickclose,
888 &wrong_funding))
889 master_badmsg(WIRE_CLOSINGD_INIT, msg);
890
891 /* 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
fmt_bitcoin_txidFunction · 0.85
send_offerFunction · 0.85
receive_offerFunction · 0.85
do_quickcloseFunction · 0.85
init_feerangeFunction · 0.85
adjust_feerangeFunction · 0.85

Tested by

no test coverage detected