Skip to content

Commit e837a1d

Browse files
committed
Ignore custom message types
1 parent 91967f0 commit e837a1d

23 files changed

+152
-37
lines changed

bindings/LDK/options/Event.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ Event_write(objPointer)
351351

352352
public func getPath() -> [RouteHop] {
353353
return Bindings.LDKCVec_RouteHopZ_to_array(nativeType: self.cOpaqueStruct!.path, deallocate: false)
354+
354355
.map { (cOpaqueStruct) in
355356
RouteHop(pointer: cOpaqueStruct).dangle()
356357
}
@@ -405,6 +406,7 @@ Event_write(objPointer)
405406

406407
public func getOutputs() -> [SpendableOutputDescriptor] {
407408
return Bindings.LDKCVec_SpendableOutputDescriptorZ_to_array(nativeType: self.cOpaqueStruct!.outputs, deallocate: false)
409+
408410
.map { (cOpaqueStruct) in
409411
SpendableOutputDescriptor(pointer: cOpaqueStruct).dangle()
410412
}

bindings/LDK/options/MonitorEvent.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,16 @@ public class MonitorEvent: NativeTypeWrapper {
5353
if self.cOpaqueStruct?.tag != LDKMonitorEvent_CommitmentTxConfirmed {
5454
return nil
5555
}
56-
return OutPoint(pointer: self.cOpaqueStruct!.commitment_tx_confirmed, anchor: self)
56+
return
57+
{ () in
58+
let cStruct =
59+
self.cOpaqueStruct!.commitment_tx_confirmed;
60+
if cStruct.inner == nil {
61+
return nil
62+
}
63+
return OutPoint(pointer: cStruct, anchor: self)
64+
}()
65+
5766
}
5867

5968

bindings/LDK/options/PaymentSendFailure.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public class PaymentSendFailure: NativeTypeWrapper {
5858
return nil
5959
}
6060
return Bindings.LDKCVec_CResult_NoneAPIErrorZZ_to_array(nativeType: self.cOpaqueStruct!.path_parameter_error, deallocate: false)
61+
6162
.map { (cOpaqueStruct) in
6263
Result_NoneAPIErrorZ(pointer: cOpaqueStruct).dangle()
6364
}
@@ -69,6 +70,7 @@ public class PaymentSendFailure: NativeTypeWrapper {
6970
return nil
7071
}
7172
return Bindings.LDKCVec_APIErrorZ_to_array(nativeType: self.cOpaqueStruct!.all_failed_retry_safe, deallocate: false)
73+
7274
.map { (cOpaqueStruct) in
7375
APIError(pointer: cOpaqueStruct).dangle()
7476
}
@@ -80,6 +82,7 @@ public class PaymentSendFailure: NativeTypeWrapper {
8082
return nil
8183
}
8284
return Bindings.LDKCVec_CResult_NoneAPIErrorZZ_to_array(nativeType: self.cOpaqueStruct!.partial_failure, deallocate: false)
85+
8386
.map { (cOpaqueStruct) in
8487
Result_NoneAPIErrorZ(pointer: cOpaqueStruct).dangle()
8588
}

bindings/LDK/options/SpendableOutputDescriptor.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,17 @@ SpendableOutputDescriptor_write(objPointer)
153153

154154

155155

156-
public func getOutpoint() -> OutPoint {
157-
return OutPoint(pointer: self.cOpaqueStruct!.outpoint, anchor: self)
156+
public func getOutpoint() -> OutPoint? {
157+
return
158+
{ () in
159+
let cStruct =
160+
self.cOpaqueStruct!.outpoint;
161+
if cStruct.inner == nil {
162+
return nil
163+
}
164+
return OutPoint(pointer: cStruct, anchor: self)
165+
}()
166+
158167
}
159168

160169
public func getOutput() -> TxOut {

bindings/LDK/results/Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ: NativeTypeWrap
4848
public func getValue() -> [C2Tuple_BlockHashChannelMonitorZ]? {
4949
if self.cOpaqueStruct?.result_ok == true {
5050
return Bindings.LDKCVec_C2Tuple_BlockHashChannelMonitorZZ_to_array(nativeType: self.cOpaqueStruct!.contents.result.pointee, deallocate: false)
51+
5152
.map { (cOpaqueStruct) in
5253
C2Tuple_BlockHashChannelMonitorZ(pointer: cOpaqueStruct).dangle()
5354
}

bindings/LDK/results/Result_OutPointDecodeErrorZ.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,16 @@ public class Result_OutPointDecodeErrorZ: NativeTypeWrapper {
4747

4848
public func getValue() -> OutPoint? {
4949
if self.cOpaqueStruct?.result_ok == true {
50-
return OutPoint(pointer: self.cOpaqueStruct!.contents.result.pointee, anchor: self)
50+
return
51+
{ () in
52+
let cStruct =
53+
self.cOpaqueStruct!.contents.result.pointee;
54+
if cStruct.inner == nil {
55+
return nil
56+
}
57+
return OutPoint(pointer: cStruct, anchor: self)
58+
}()
59+
5160
}
5261
return nil
5362
}

bindings/LDK/structs/ChainMonitor.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public init(pointer: LDKChainMonitor, anchor: NativeTypeWrapper){
6060
return Bindings.LDKCVec_BalanceZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChainMonitor>) in
6161
ChainMonitor_get_claimable_balances(this_argPointer, ignored_channelsWrapper.dangle().cOpaqueStruct!)
6262
})
63+
6364
.map { (cOpaqueStruct) in
6465
Balance(pointer: cOpaqueStruct)
6566
}

bindings/LDK/structs/ChannelDetails.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,20 @@ ChannelDetails_get_counterparty(this_ptrPointer)
6464
return ChannelDetails_set_counterparty(this_ptrPointer, val.danglingClone().cOpaqueStruct!);
6565
}
6666

67-
public func get_funding_txo() -> OutPoint {
67+
public func get_funding_txo() -> OutPoint? {
6868

69-
return OutPoint(pointer: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
69+
return
70+
{ () in
71+
let cStruct =
72+
withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKChannelDetails>) in
7073
ChannelDetails_get_funding_txo(this_ptrPointer)
71-
});
74+
};
75+
if cStruct.inner == nil {
76+
return nil
77+
}
78+
return OutPoint(pointer: cStruct)
79+
}()
80+
;
7281
}
7382

7483
public func set_funding_txo(val: OutPoint) -> Void {

bindings/LDK/structs/ChannelManager.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ ChannelManager_create_channel(this_argPointer, Bindings.new_LDKPublicKey(array:
5353
return Bindings.LDKCVec_ChannelDetailsZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelManager>) in
5454
ChannelManager_list_channels(this_argPointer)
5555
})
56+
5657
.map { (cOpaqueStruct) in
5758
ChannelDetails(pointer: cOpaqueStruct)
5859
}
@@ -64,6 +65,7 @@ ChannelManager_list_channels(this_argPointer)
6465
return Bindings.LDKCVec_ChannelDetailsZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelManager>) in
6566
ChannelManager_list_usable_channels(this_argPointer)
6667
})
68+
6769
.map { (cOpaqueStruct) in
6870
ChannelDetails(pointer: cOpaqueStruct)
6971
}

bindings/LDK/structs/ChannelMonitor.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ ChannelMonitor_get_funding_txo(this_argPointer)
8181
return Bindings.LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
8282
ChannelMonitor_get_outputs_to_watch(this_argPointer)
8383
})
84+
8485
.map { (cOpaqueStruct) in
8586
C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(pointer: cOpaqueStruct)
8687
}
@@ -101,6 +102,7 @@ ChannelMonitor_load_outputs_to_watch(this_argPointer, filterPointer)
101102
return Bindings.LDKCVec_MonitorEventZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
102103
ChannelMonitor_get_and_clear_pending_monitor_events(this_argPointer)
103104
})
105+
104106
.map { (cOpaqueStruct) in
105107
MonitorEvent(pointer: cOpaqueStruct)
106108
}
@@ -112,6 +114,7 @@ ChannelMonitor_get_and_clear_pending_monitor_events(this_argPointer)
112114
return Bindings.LDKCVec_EventZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
113115
ChannelMonitor_get_and_clear_pending_events(this_argPointer)
114116
})
117+
115118
.map { (cOpaqueStruct) in
116119
Event(pointer: cOpaqueStruct)
117120
}
@@ -149,6 +152,7 @@ withUnsafePointer(to: Bindings.array_to_tuple80(array: header)) { (headerPointer
149152
ChannelMonitor_block_connected(this_argPointer, headerPointer, txdataWrapper.dangle().cOpaqueStruct!, height, broadcaster.cOpaqueStruct!, fee_estimator.cOpaqueStruct!, logger.cOpaqueStruct!)
150153
}
151154
})
155+
152156
.map { (cOpaqueStruct) in
153157
TransactionOutputs(pointer: cOpaqueStruct)
154158
}
@@ -186,6 +190,7 @@ withUnsafePointer(to: Bindings.array_to_tuple80(array: header)) { (headerPointer
186190
ChannelMonitor_transactions_confirmed(this_argPointer, headerPointer, txdataWrapper.dangle().cOpaqueStruct!, height, broadcaster.cOpaqueStruct!, fee_estimator.cOpaqueStruct!, logger.cOpaqueStruct!)
187191
}
188192
})
193+
189194
.map { (cOpaqueStruct) in
190195
TransactionOutputs(pointer: cOpaqueStruct)
191196
}
@@ -208,6 +213,7 @@ withUnsafePointer(to: Bindings.array_to_tuple80(array: header)) { (headerPointer
208213
ChannelMonitor_best_block_updated(this_argPointer, headerPointer, height, broadcaster.cOpaqueStruct!, fee_estimator.cOpaqueStruct!, logger.cOpaqueStruct!)
209214
}
210215
})
216+
211217
.map { (cOpaqueStruct) in
212218
TransactionOutputs(pointer: cOpaqueStruct)
213219
}
@@ -237,6 +243,7 @@ ChannelMonitor_current_best_block(this_argPointer)
237243
return Bindings.LDKCVec_BalanceZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
238244
ChannelMonitor_get_claimable_balances(this_argPointer)
239245
})
246+
240247
.map { (cOpaqueStruct) in
241248
Balance(pointer: cOpaqueStruct)
242249
}

0 commit comments

Comments
 (0)