[bindings] Update eq/clone trait fns to take object, not this_arg
[rust-lightning] / lightning-c-bindings / demo.cpp
index f8aece19d7bf9ad82483d001684526f11c18d2d0..84d7904f8e62e59e7e0ee156d326ec078a62f083 100644 (file)
@@ -191,8 +191,8 @@ uintptr_t sock_send_data(void *this_arg, LDKu8slice data, bool resume_read) {
 void sock_disconnect_socket(void *this_arg) {
        close((int)((long)this_arg));
 }
-bool sock_eq(const void *this_arg, const void *other_arg) {
-       return this_arg == other_arg;
+bool sock_eq(const void *this_arg, const LDKSocketDescriptor *other_arg) {
+       return this_arg == other_arg->this_arg;
 }
 uint64_t sock_hash(const void *this_arg) {
        return (uint64_t)this_arg;
@@ -420,19 +420,19 @@ int main() {
        }
 
        LDKCVec_C2Tuple_usizeTransactionZZ txdata { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 };
-       *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false });
+       *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false });
        ChannelManager_block_connected(&cm1, &channel_open_header, txdata, 1);
 
        txdata = LDKCVec_C2Tuple_usizeTransactionZZ { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 };
-       *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false });
+       *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false });
        ChannelManager_block_connected(&cm2, &channel_open_header, txdata, 1);
 
        txdata = LDKCVec_C2Tuple_usizeTransactionZZ { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 };
-       *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false });
+       *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false });
        mons1.ConnectBlock(&channel_open_header, 1, txdata, broadcast, fee_est);
 
        txdata = LDKCVec_C2Tuple_usizeTransactionZZ { .data = (LDKC2TupleTempl_usize__Transaction*)malloc(sizeof(LDKC2Tuple_usizeTransactionZ)), .datalen = 1 };
-       *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false });
+       *txdata.data = C2Tuple_usizeTransactionZ_new(0, LDKTransaction { .data = (uint8_t*)channel_open_tx, .datalen = sizeof(channel_open_tx), .data_is_owned = false });
        mons2.ConnectBlock(&channel_open_header, 1, txdata, broadcast, fee_est);
 
        ChannelManager_block_connected(&cm1, &header_1, LDKCVec_C2Tuple_usizeTransactionZZ { .data = NULL, .datalen = 0 }, 2);