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

Function main

wire/test/run-peer-wire.c:956–1174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954 test_bitflip_and_short(a, b, type, false)
955
956int main(int argc, char *argv[])
957{
958 struct msg_channel_announcement ca, *ca2;
959 struct msg_channel_ready fl, *fl2;
960 struct msg_announcement_signatures as, *as2;
961 struct msg_update_fail_htlc ufh, *ufh2;
962 struct msg_commitment_signed cs, *cs2;
963 struct msg_funding_signed fs, *fs2;
964 struct msg_closing_signed cls, *cls2;
965 struct msg_update_fulfill_htlc uflh, *uflh2;
966 struct msg_error e, *e2;
967 struct msg_init init, *init2;
968 struct msg_update_fee uf, *uf2;
969 struct msg_shutdown shutdown, *shutdown2;
970 struct msg_funding_created fc, *fc2;
971 struct msg_revoke_and_ack raa, *raa2;
972 struct msg_open_channel oc, *oc2;
973 struct msg_channel_update cu, *cu2;
974 struct msg_accept_channel ac, *ac2;
975 struct msg_update_add_htlc uah, *uah2;
976 struct msg_node_announcement na, *na2;
977 void *ctx = tal(NULL, char);
978 size_t i;
979 u8 *msg;
980
981 common_setup(argv[0]);
982
983 memset(&ca, 2, sizeof(ca));
984 set_node_id(&ca.node_id_1);
985 set_node_id(&ca.node_id_2);
986 set_pubkey(&ca.bitcoin_key_1);
987 set_pubkey(&ca.bitcoin_key_2);
988 ca.features = tal_arr(ctx, u8, 2);
989 memset(ca.features, 2, 2);
990
991 msg = towire_struct_channel_announcement(ctx, &ca);
992 ca2 = fromwire_struct_channel_announcement(ctx, msg);
993 assert(channel_announcement_eq(&ca, ca2));
994 test_corruption(&ca, ca2, channel_announcement);
995
996 memset(&fl, 2, sizeof(fl));
997 fl.tlvs = tlv_channel_ready_tlvs_new(ctx);
998 fl.tlvs->short_channel_id = tal(ctx, struct short_channel_id);
999 set_scid(fl.tlvs->short_channel_id);
1000 set_pubkey(&fl.next_per_commitment_point);
1001
1002 msg = towire_struct_channel_ready(ctx, &fl);
1003 fl2 = fromwire_struct_channel_ready(ctx, msg);
1004 assert(channel_ready_eq(&fl, fl2));
1005 test_corruption_tlv(&fl, fl2, channel_ready);
1006
1007 memset(&as, 2, sizeof(as));
1008
1009 msg = towire_struct_announcement_signatures(ctx, &as);
1010 as2 = fromwire_struct_announcement_signatures(ctx, msg);
1011 assert(announcement_signatures_eq(&as, as2));
1012 test_corruption(&as, as2, announcement_signatures);
1013

Callers

nothing calls this directly

Calls 15

common_setupFunction · 0.85
set_node_idFunction · 0.85
set_pubkeyFunction · 0.85
channel_announcement_eqFunction · 0.85
set_scidFunction · 0.85
channel_ready_eqFunction · 0.85

Tested by

no test coverage detected