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

Function test_sync_write

tests/fuzz/fuzz-open_channel.c:91–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91static bool test_sync_write(int fd, const void *msg TAKES)
92{
93 if (fd == REQ_FD) /* lightningd message */
94 {
95 ld_writes++;
96 /* Subsequent calls to this are from
97 * negotiation_aborted, so we ignore those.
98 */
99 if (ld_writes == 1) {
100 struct amount_sat funding_satoshis;
101 struct amount_msat push_msat;
102 struct amount_sat dust_limit_satoshis;
103 struct amount_msat max_htlc_value_in_flight_msat;
104 struct amount_sat channel_reserve_satoshis;
105 struct amount_msat htlc_minimum_msat;
106 u32 feerate_per_kw;
107 u16 to_self_delay;
108 u16 max_accepted_htlcs;
109 u8 channel_flags;
110 u8 *shutdown_scriptpubkey;
111 struct channel_type *ctype;
112
113 assert(fromwire_openingd_got_offer(tmpctx, msg,
114 &funding_satoshis,
115 &push_msat,
116 &dust_limit_satoshis,
117 &max_htlc_value_in_flight_msat,
118 &channel_reserve_satoshis,
119 &htlc_minimum_msat,
120 &feerate_per_kw,
121 &to_self_delay,
122 &max_accepted_htlcs,
123 &channel_flags,
124 &shutdown_scriptpubkey,
125 &ctype));
126 }
127 }
128 else if (fd == HSM_FD) /* HSMD message */
129 {
130 hsmd_writes++;
131 if (hsmd_writes == 1) {
132 bool is_outbound;
133 struct amount_sat channel_value;
134 struct amount_msat push_value;
135 struct bitcoin_txid funding_txid;
136 u16 funding_txout, local_to_self_delay, remote_to_self_delay;
137 u8 *local_shutdown_script, *remote_shutdown_script;
138 u32 *local_shutdown_wallet_index;
139 struct basepoints remote_basepoints;
140 struct pubkey remote_funding_pubkey;
141 struct channel_type *channel_type;
142
143 assert(fromwire_hsmd_setup_channel(tmpctx, msg,
144 &is_outbound,
145 &channel_value,
146 &push_value,
147 &funding_txid,
148 &funding_txout,

Callers 2

test_peer_writeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected