Skip to content

Commit d1e33c2

Browse files
committed
Do not deallocate vectors when returned arrays contain non-primitives.
1 parent 3f2c15d commit d1e33c2

15 files changed

+28
-26
lines changed

ci/LDKSwift/Sources/LDKSwift/bindings/Bindings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6949,7 +6949,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
69496949
*/
69506950

69516951
public class func get_ldk_swift_bindings_version() -> String {
6952-
return "999dff8638d6c9595c4a0fd8ed416be234374d51"
6952+
return "3f2c15ddca88239c3ddc57c1e4cf63a02dca5492"
69536953
}
69546954

69556955
}

ci/LDKSwift/Sources/LDKSwift/bindings/structs/ChainMonitor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public init(pointer: LDKChainMonitor, anchor: NativeTypeWrapper){
7373

7474
return Bindings.LDKCVec_BalanceZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChainMonitor>) in
7575
ChainMonitor_get_claimable_balances(this_argPointer, ignored_channelsWrapper.dangle().cOpaqueStruct!)
76-
}, callerContext: "ChainMonitor::get_claimable_balances")
76+
}, callerContext: "ChainMonitor::get_claimable_balances", deallocate: false)
7777

7878
.map { (cOpaqueStruct) in
7979
Balance(pointer: cOpaqueStruct)
@@ -92,7 +92,7 @@ ChainMonitor_get_monitor(this_argPointer, funding_txo.danglingClone().cOpaqueStr
9292

9393
return Bindings.LDKCVec_OutPointZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChainMonitor>) in
9494
ChainMonitor_list_monitors(this_argPointer)
95-
}, callerContext: "ChainMonitor::list_monitors")
95+
}, callerContext: "ChainMonitor::list_monitors", deallocate: false)
9696

9797
.map { (cOpaqueStruct) in
9898
OutPoint(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/ChannelManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ChannelManager_create_channel(this_argPointer, Bindings.new_LDKPublicKey(array:
6666

6767
return Bindings.LDKCVec_ChannelDetailsZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelManager>) in
6868
ChannelManager_list_channels(this_argPointer)
69-
}, callerContext: "ChannelManager::list_channels")
69+
}, callerContext: "ChannelManager::list_channels", deallocate: false)
7070

7171
.map { (cOpaqueStruct) in
7272
ChannelDetails(pointer: cOpaqueStruct)
@@ -78,7 +78,7 @@ ChannelManager_list_channels(this_argPointer)
7878

7979
return Bindings.LDKCVec_ChannelDetailsZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelManager>) in
8080
ChannelManager_list_usable_channels(this_argPointer)
81-
}, callerContext: "ChannelManager::list_usable_channels")
81+
}, callerContext: "ChannelManager::list_usable_channels", deallocate: false)
8282

8383
.map { (cOpaqueStruct) in
8484
ChannelDetails(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/ChannelMonitor.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ChannelMonitor_get_funding_txo(this_argPointer)
8686

8787
return Bindings.LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
8888
ChannelMonitor_get_outputs_to_watch(this_argPointer)
89-
}, callerContext: "ChannelMonitor::get_outputs_to_watch")
89+
}, callerContext: "ChannelMonitor::get_outputs_to_watch", deallocate: false)
9090

9191
.map { (cOpaqueStruct) in
9292
C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(pointer: cOpaqueStruct)
@@ -107,7 +107,7 @@ ChannelMonitor_load_outputs_to_watch(this_argPointer, filterPointer)
107107

108108
return Bindings.LDKCVec_MonitorEventZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
109109
ChannelMonitor_get_and_clear_pending_monitor_events(this_argPointer)
110-
}, callerContext: "ChannelMonitor::get_and_clear_pending_monitor_events")
110+
}, callerContext: "ChannelMonitor::get_and_clear_pending_monitor_events", deallocate: false)
111111

112112
.map { (cOpaqueStruct) in
113113
MonitorEvent(pointer: cOpaqueStruct)
@@ -119,7 +119,7 @@ ChannelMonitor_get_and_clear_pending_monitor_events(this_argPointer)
119119

120120
return Bindings.LDKCVec_EventZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
121121
ChannelMonitor_get_and_clear_pending_events(this_argPointer)
122-
}, callerContext: "ChannelMonitor::get_and_clear_pending_events")
122+
}, callerContext: "ChannelMonitor::get_and_clear_pending_events", deallocate: false)
123123

124124
.map { (cOpaqueStruct) in
125125
Event(pointer: cOpaqueStruct)
@@ -164,7 +164,7 @@ ChannelMonitor_get_latest_holder_commitment_txn(this_argPointer, loggerPointer)
164164
withUnsafePointer(to: Bindings.array_to_tuple80(array: header)) { (headerPointer: UnsafePointer<(UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
165165
ChannelMonitor_block_connected(this_argPointer, headerPointer, txdataWrapper.dangle().cOpaqueStruct!, height, broadcaster.activate().cOpaqueStruct!, fee_estimator.activate().cOpaqueStruct!, logger.activate().cOpaqueStruct!)
166166
}
167-
}, callerContext: "ChannelMonitor::block_connected")
167+
}, callerContext: "ChannelMonitor::block_connected", deallocate: false)
168168

169169
.map { (cOpaqueStruct) in
170170
TransactionOutputs(pointer: cOpaqueStruct)
@@ -202,7 +202,7 @@ ChannelMonitor_block_disconnected(this_argPointer, headerPointer, height, broadc
202202
withUnsafePointer(to: Bindings.array_to_tuple80(array: header)) { (headerPointer: UnsafePointer<(UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
203203
ChannelMonitor_transactions_confirmed(this_argPointer, headerPointer, txdataWrapper.dangle().cOpaqueStruct!, height, broadcaster.activate().cOpaqueStruct!, fee_estimator.activate().cOpaqueStruct!, logger.activate().cOpaqueStruct!)
204204
}
205-
}, callerContext: "ChannelMonitor::transactions_confirmed")
205+
}, callerContext: "ChannelMonitor::transactions_confirmed", deallocate: false)
206206

207207
.map { (cOpaqueStruct) in
208208
TransactionOutputs(pointer: cOpaqueStruct)
@@ -225,7 +225,7 @@ ChannelMonitor_transaction_unconfirmed(this_argPointer, txidPointer, broadcaster
225225
withUnsafePointer(to: Bindings.array_to_tuple80(array: header)) { (headerPointer: UnsafePointer<(UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
226226
ChannelMonitor_best_block_updated(this_argPointer, headerPointer, height, broadcaster.activate().cOpaqueStruct!, fee_estimator.activate().cOpaqueStruct!, logger.activate().cOpaqueStruct!)
227227
}
228-
}, callerContext: "ChannelMonitor::best_block_updated")
228+
}, callerContext: "ChannelMonitor::best_block_updated", deallocate: false)
229229

230230
.map { (cOpaqueStruct) in
231231
TransactionOutputs(pointer: cOpaqueStruct)
@@ -251,7 +251,7 @@ ChannelMonitor_current_best_block(this_argPointer)
251251

252252
return Bindings.LDKCVec_BalanceZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
253253
ChannelMonitor_get_claimable_balances(this_argPointer)
254-
}, callerContext: "ChannelMonitor::get_claimable_balances")
254+
}, callerContext: "ChannelMonitor::get_claimable_balances", deallocate: false)
255255

256256
.map { (cOpaqueStruct) in
257257
Balance(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/CommitmentUpdate.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ extension Bindings {
9191

9292
return Bindings.LDKCVec_UpdateAddHTLCZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentUpdate>) in
9393
CommitmentUpdate_get_update_add_htlcs(this_ptrPointer)
94-
}, callerContext: "CommitmentUpdate::get_update_add_htlcs")
94+
}, callerContext: "CommitmentUpdate::get_update_add_htlcs", deallocate: false)
9595

9696
.map { (cOpaqueStruct) in
9797
UpdateAddHTLC(pointer: cOpaqueStruct)
@@ -126,7 +126,7 @@ CommitmentUpdate_get_update_add_htlcs(this_ptrPointer)
126126

127127
return Bindings.LDKCVec_UpdateFulfillHTLCZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentUpdate>) in
128128
CommitmentUpdate_get_update_fulfill_htlcs(this_ptrPointer)
129-
}, callerContext: "CommitmentUpdate::get_update_fulfill_htlcs")
129+
}, callerContext: "CommitmentUpdate::get_update_fulfill_htlcs", deallocate: false)
130130

131131
.map { (cOpaqueStruct) in
132132
UpdateFulfillHTLC(pointer: cOpaqueStruct)
@@ -161,7 +161,7 @@ CommitmentUpdate_get_update_fulfill_htlcs(this_ptrPointer)
161161

162162
return Bindings.LDKCVec_UpdateFailHTLCZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentUpdate>) in
163163
CommitmentUpdate_get_update_fail_htlcs(this_ptrPointer)
164-
}, callerContext: "CommitmentUpdate::get_update_fail_htlcs")
164+
}, callerContext: "CommitmentUpdate::get_update_fail_htlcs", deallocate: false)
165165

166166
.map { (cOpaqueStruct) in
167167
UpdateFailHTLC(pointer: cOpaqueStruct)
@@ -196,7 +196,7 @@ CommitmentUpdate_get_update_fail_htlcs(this_ptrPointer)
196196

197197
return Bindings.LDKCVec_UpdateFailMalformedHTLCZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentUpdate>) in
198198
CommitmentUpdate_get_update_fail_malformed_htlcs(this_ptrPointer)
199-
}, callerContext: "CommitmentUpdate::get_update_fail_malformed_htlcs")
199+
}, callerContext: "CommitmentUpdate::get_update_fail_malformed_htlcs", deallocate: false)
200200

201201
.map { (cOpaqueStruct) in
202202
UpdateFailMalformedHTLC(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/Invoice.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Invoice_min_final_cltv_expiry(this_argPointer)
162162

163163
return Bindings.LDKCVec_PrivateRouteZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInvoice>) in
164164
Invoice_private_routes(this_argPointer)
165-
}, callerContext: "Invoice::private_routes")
165+
}, callerContext: "Invoice::private_routes", deallocate: false)
166166

167167
.map { (cOpaqueStruct) in
168168
PrivateRoute(pointer: cOpaqueStruct)
@@ -174,7 +174,7 @@ Invoice_private_routes(this_argPointer)
174174

175175
return Bindings.LDKCVec_RouteHintZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInvoice>) in
176176
Invoice_route_hints(this_argPointer)
177-
}, callerContext: "Invoice::route_hints")
177+
}, callerContext: "Invoice::route_hints", deallocate: false)
178178

179179
.map { (cOpaqueStruct) in
180180
RouteHint(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/NodeAnnouncementInfo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ NodeAnnouncementInfo_get_alias(this_ptrPointer)
121121

122122
return Bindings.LDKCVec_NetAddressZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKNodeAnnouncementInfo>) in
123123
NodeAnnouncementInfo_get_addresses(this_ptrPointer)
124-
}, callerContext: "NodeAnnouncementInfo::get_addresses")
124+
}, callerContext: "NodeAnnouncementInfo::get_addresses", deallocate: false)
125125

126126
.map { (cOpaqueStruct) in
127127
NetAddress(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/PaymentParameters.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ PaymentParameters_get_features(this_ptrPointer)
7777

7878
return Bindings.LDKCVec_RouteHintZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKPaymentParameters>) in
7979
PaymentParameters_get_route_hints(this_ptrPointer)
80-
}, callerContext: "PaymentParameters::get_route_hints")
80+
}, callerContext: "PaymentParameters::get_route_hints", deallocate: false)
8181

8282
.map { (cOpaqueStruct) in
8383
RouteHint(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/PhantomRouteHints.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extension Bindings {
6161

6262
return Bindings.LDKCVec_ChannelDetailsZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKPhantomRouteHints>) in
6363
PhantomRouteHints_get_channels(this_ptrPointer)
64-
}, callerContext: "PhantomRouteHints::get_channels")
64+
}, callerContext: "PhantomRouteHints::get_channels", deallocate: false)
6565

6666
.map { (cOpaqueStruct) in
6767
ChannelDetails(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/RawInvoice.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ RawInvoice_features(this_argPointer)
146146

147147
return Bindings.LDKCVec_PrivateRouteZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
148148
RawInvoice_private_routes(this_argPointer)
149-
}, callerContext: "RawInvoice::private_routes")
149+
}, callerContext: "RawInvoice::private_routes", deallocate: false)
150150

151151
.map { (cOpaqueStruct) in
152152
PrivateRoute(pointer: cOpaqueStruct)

0 commit comments

Comments
 (0)