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

Function main

closingd/closingd.c:809–1063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

807}
808
809int main(int argc, char *argv[])
810{
811 setup_locale();
812
813 const tal_t *ctx = tal(NULL, char);
814 struct per_peer_state *pps;
815 u8 *msg;
816 struct pubkey funding_pubkey[NUM_SIDES];
817 struct bitcoin_txid closing_txid;
818 struct bitcoin_outpoint funding;
819 struct amount_sat funding_sats, out[NUM_SIDES];
820 struct amount_sat our_dust_limit;
821 struct amount_sat min_fee_to_accept, offer[NUM_SIDES],
822 max_fee_to_accept;
823 u32 min_feerate, initial_feerate, max_feerate;
824 struct feerange feerange;
825 enum side opener;
826 u32 *local_wallet_index;
827 struct ext_key *local_wallet_ext_key;
828 u8 *scriptpubkey[NUM_SIDES], *funding_wscript;
829 u64 fee_negotiation_step;
830 u8 fee_negotiation_step_unit;
831 char fee_negotiation_step_str[32]; /* fee_negotiation_step + "sat" */
832 struct channel_id channel_id;
833 enum side whose_turn;
834 bool use_quickclose;
835 struct tlv_closing_signed_tlvs_fee_range *our_feerange, **their_feerange;
836 struct bitcoin_outpoint *wrong_funding;
837 bool developer;
838
839 developer = subdaemon_setup(argc, argv);
840
841 status_setup_sync(REQ_FD);
842
843 msg = wire_sync_read(tmpctx, REQ_FD);
844 if (!fromwire_closingd_init(ctx, msg,
845 &chainparams,
846 &channel_id,
847 &funding,
848 &funding_sats,
849 &funding_pubkey[LOCAL],
850 &funding_pubkey[REMOTE],
851 &opener,
852 &out[LOCAL],
853 &out[REMOTE],
854 &our_dust_limit,
855 &min_feerate, &initial_feerate, &max_feerate,
856 &local_wallet_index,
857 &local_wallet_ext_key,
858 &scriptpubkey[LOCAL],
859 &scriptpubkey[REMOTE],
860 &fee_negotiation_step,
861 &fee_negotiation_step_unit,
862 &use_quickclose,
863 &wrong_funding))
864 master_badmsg(WIRE_CLOSINGD_INIT, msg);
865
866 /* 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