Skip to content

Commit 6298a02

Browse files
authored
Merge pull request #34 from lightningdevkit/socket_handling_deinit_fixes
Fix socket deinit issues by making sure TCPPeerHandler gets interrupted upon deinit.
2 parents f579b1d + eba0294 commit 6298a02

File tree

121 files changed

+3035
-2516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+3035
-2516
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
indent_style = tab
33
indent_size = 4
44
insert_final_newline = true
5+
trim_trailing_whitespace = true
56

67
[Makefile]
78

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ folder due to the previous `genbindings.sh` step. As Docker won't have access to
6767
replace those lines with the following:
6868

6969
```yaml
70-
lightning = { git = "https://github.com/thebluematt/rust-lightning", rev = "xxx", features = ["std"] }
71-
lightning-persister = { git = "https://github.com/thebluematt/rust-lightning", rev = "xxx" }
72-
lightning-invoice = { git = "https://github.com/thebluematt/rust-lightning", rev = "xxx" }
73-
lightning-background-processor = { git = "https://github.com/thebluematt/rust-lightning", rev = "xxx" }
70+
lightning = { git = "https://github.com/thebluematt/rust-lightning", branch = "2021-03-java-bindings-base", default-features = false }
71+
lightning-persister = { git = "https://github.com/thebluematt/rust-lightning", branch = "2021-03-java-bindings-base", default-features = false }
72+
lightning-invoice = { git = "https://github.com/thebluematt/rust-lightning", branch = "2021-03-java-bindings-base", default-features = false }
73+
lightning-background-processor = { git = "https://github.com/thebluematt/rust-lightning", branch = "2021-03-java-bindings-base", default-features = false }
7474
```
7575

7676
You will note that the revision is unspecified and is currently just placeholder `xxx`s. To obtain the revision,

bindings/LDK/Bindings.swift

Lines changed: 72 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ open class NativeTypeWrapper: Hashable {
6565

6666
}
6767

68+
open class NativeTraitWrapper: NativeTypeWrapper {
69+
70+
public func activate() -> Self {
71+
Bindings.cacheInstance(instance: self)
72+
return self
73+
}
74+
75+
public func activateOnce() -> Self {
76+
Bindings.cacheInstance(instance: self)
77+
return self
78+
}
79+
80+
}
81+
6882
public class Bindings {
6983

7084
internal static var minimumPrintSeverity: PrintSeverity = .WARNING
@@ -6010,7 +6024,7 @@ public class Bindings {
60106024
}
60116025

60126026
return
6013-
Result_PublicKeyErrorZ(pointer: recover_pk(msgWrapper.cOpaqueStruct!, Bindings.new_LDKStr(string: sig)))
6027+
Result_PublicKeyErrorZ(pointer: recover_pk(msgWrapper.cOpaqueStruct!, Bindings.new_LDKStr(string: sig, chars_is_owned: true)))
60146028

60156029

60166030
}
@@ -6023,7 +6037,7 @@ public class Bindings {
60236037
}
60246038

60256039
return
6026-
verify(msgWrapper.cOpaqueStruct!, Bindings.new_LDKStr(string: sig), Bindings.new_LDKPublicKey(array: pk))
6040+
verify(msgWrapper.cOpaqueStruct!, Bindings.new_LDKStr(string: sig, chars_is_owned: true), Bindings.new_LDKPublicKey(array: pk))
60276041

60286042

60296043
}
@@ -6053,7 +6067,7 @@ public class Bindings {
60536067
serWrapper.noOpRetain()
60546068
}
60556069

6056-
return withUnsafePointer(to: arg.cOpaqueStruct!) { (argPointer: UnsafePointer<LDKKeysInterface>) in
6070+
return withUnsafePointer(to: arg.activateOnce().cOpaqueStruct!) { (argPointer: UnsafePointer<LDKKeysInterface>) in
60576071

60586072
Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(pointer: C2Tuple_BlockHashChannelMonitorZ_read(serWrapper.cOpaqueStruct!, argPointer))
60596073

@@ -6230,10 +6244,10 @@ withUnsafePointer(to: htlc.cOpaqueStruct!) { (htlcPointer: UnsafePointer<LDKHTLC
62306244

62316245
return withUnsafePointer(to: route_params.cOpaqueStruct!) { (route_paramsPointer: UnsafePointer<LDKRouteParameters>) in
62326246
withUnsafePointer(to: network.cOpaqueStruct!) { (networkPointer: UnsafePointer<LDKNetworkGraph>) in
6233-
withUnsafePointer(to: scorer.cOpaqueStruct!) { (scorerPointer: UnsafePointer<LDKScore>) in
6247+
withUnsafePointer(to: scorer.activateOnce().cOpaqueStruct!) { (scorerPointer: UnsafePointer<LDKScore>) in
62346248
withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (random_seed_bytesPointer: 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)>) in
62356249

6236-
Result_RouteLightningErrorZ(pointer: find_route(Bindings.new_LDKPublicKey(array: our_node_pubkey), route_paramsPointer, networkPointer, first_hopsPointer, logger.cOpaqueStruct!, scorerPointer, random_seed_bytesPointer))
6250+
Result_RouteLightningErrorZ(pointer: find_route(Bindings.new_LDKPublicKey(array: our_node_pubkey), route_paramsPointer, networkPointer, first_hopsPointer, logger.activate().cOpaqueStruct!, scorerPointer, random_seed_bytesPointer))
62376251

62386252
}
62396253
}
@@ -6255,7 +6269,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
62556269
}
62566270

62576271
return
6258-
Result_InvoiceSignOrCreationErrorZ(pointer: create_phantom_invoice(amt_msat.danglingClone().cOpaqueStruct!, Bindings.new_LDKStr(string: description), Bindings.new_LDKThirtyTwoBytes(array: payment_hash), Bindings.new_LDKThirtyTwoBytes(array: payment_secret), phantom_route_hintsWrapper.dangle().cOpaqueStruct!, keys_manager.cOpaqueStruct!, network))
6272+
Result_InvoiceSignOrCreationErrorZ(pointer: create_phantom_invoice(amt_msat.danglingClone().cOpaqueStruct!, Bindings.new_LDKStr(string: description, chars_is_owned: true), Bindings.new_LDKThirtyTwoBytes(array: payment_hash), Bindings.new_LDKThirtyTwoBytes(array: payment_secret), phantom_route_hintsWrapper.dangle().cOpaqueStruct!, keys_manager.activate().cOpaqueStruct!, network))
62596273

62606274

62616275
}
@@ -6273,7 +6287,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
62736287
}
62746288

62756289
return
6276-
Result_InvoiceSignOrCreationErrorZ(pointer: create_phantom_invoice_with_description_hash(amt_msat.danglingClone().cOpaqueStruct!, description_hash.danglingClone().cOpaqueStruct!, Bindings.new_LDKThirtyTwoBytes(array: payment_hash), Bindings.new_LDKThirtyTwoBytes(array: payment_secret), phantom_route_hintsWrapper.dangle().cOpaqueStruct!, keys_manager.cOpaqueStruct!, network))
6290+
Result_InvoiceSignOrCreationErrorZ(pointer: create_phantom_invoice_with_description_hash(amt_msat.danglingClone().cOpaqueStruct!, description_hash.danglingClone().cOpaqueStruct!, Bindings.new_LDKThirtyTwoBytes(array: payment_hash), Bindings.new_LDKThirtyTwoBytes(array: payment_secret), phantom_route_hintsWrapper.dangle().cOpaqueStruct!, keys_manager.activate().cOpaqueStruct!, network))
62776291

62786292

62796293
}
@@ -6282,7 +6296,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
62826296

62836297
return withUnsafePointer(to: channelmanager.cOpaqueStruct!) { (channelmanagerPointer: UnsafePointer<LDKChannelManager>) in
62846298

6285-
Result_InvoiceSignOrCreationErrorZ(pointer: create_invoice_from_channelmanager(channelmanagerPointer, keys_manager.cOpaqueStruct!, network, amt_msat.danglingClone().cOpaqueStruct!, Bindings.new_LDKStr(string: description)))
6299+
Result_InvoiceSignOrCreationErrorZ(pointer: create_invoice_from_channelmanager(channelmanagerPointer, keys_manager.activate().cOpaqueStruct!, network, amt_msat.danglingClone().cOpaqueStruct!, Bindings.new_LDKStr(string: description, chars_is_owned: true)))
62866300

62876301
}
62886302

@@ -6292,7 +6306,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
62926306

62936307
return withUnsafePointer(to: channelmanager.cOpaqueStruct!) { (channelmanagerPointer: UnsafePointer<LDKChannelManager>) in
62946308

6295-
Result_InvoiceSignOrCreationErrorZ(pointer: create_invoice_from_channelmanager_with_description_hash(channelmanagerPointer, keys_manager.cOpaqueStruct!, network, amt_msat.danglingClone().cOpaqueStruct!, description_hash.danglingClone().cOpaqueStruct!))
6309+
Result_InvoiceSignOrCreationErrorZ(pointer: create_invoice_from_channelmanager_with_description_hash(channelmanagerPointer, keys_manager.activate().cOpaqueStruct!, network, amt_msat.danglingClone().cOpaqueStruct!, description_hash.danglingClone().cOpaqueStruct!))
62966310

62976311
}
62986312

@@ -6302,7 +6316,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
63026316

63036317
return withUnsafePointer(to: channelmanager.cOpaqueStruct!) { (channelmanagerPointer: UnsafePointer<LDKChannelManager>) in
63046318

6305-
Result_InvoiceSignOrCreationErrorZ(pointer: create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanagerPointer, keys_manager.cOpaqueStruct!, network, amt_msat.danglingClone().cOpaqueStruct!, description_hash.danglingClone().cOpaqueStruct!, duration_since_epoch))
6319+
Result_InvoiceSignOrCreationErrorZ(pointer: create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanagerPointer, keys_manager.activate().cOpaqueStruct!, network, amt_msat.danglingClone().cOpaqueStruct!, description_hash.danglingClone().cOpaqueStruct!, duration_since_epoch))
63066320

63076321
}
63086322

@@ -6312,40 +6326,61 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
63126326

63136327
return withUnsafePointer(to: channelmanager.cOpaqueStruct!) { (channelmanagerPointer: UnsafePointer<LDKChannelManager>) in
63146328

6315-
Result_InvoiceSignOrCreationErrorZ(pointer: create_invoice_from_channelmanager_and_duration_since_epoch(channelmanagerPointer, keys_manager.cOpaqueStruct!, network, amt_msat.danglingClone().cOpaqueStruct!, Bindings.new_LDKStr(string: description), duration_since_epoch))
6329+
Result_InvoiceSignOrCreationErrorZ(pointer: create_invoice_from_channelmanager_and_duration_since_epoch(channelmanagerPointer, keys_manager.activate().cOpaqueStruct!, network, amt_msat.danglingClone().cOpaqueStruct!, Bindings.new_LDKStr(string: description, chars_is_owned: true), duration_since_epoch))
63166330

63176331
}
63186332

63196333
}
63206334

63216335
/* STATIC_METHODS_END */
63226336

6323-
static var nativelyExposedInstances = [String: NativeTypeWrapper]()
6337+
static var nativelyExposedInstances = [UInt: NativeTraitWrapper]()
6338+
static var nativelyExposedInstanceReferenceCounter = [UInt: Int]()
6339+
6340+
public class func cacheInstance(instance: NativeTraitWrapper, countIdempotently: Bool = false) {
6341+
let key = instance.globalInstanceNumber
6342+
let referenceCount = (Self.nativelyExposedInstanceReferenceCounter[key] ?? 0) + 1
6343+
if (!countIdempotently || referenceCount == 1){
6344+
// if we count non-idempotently, always update the counter
6345+
// otherwise, only update the counter the first time
6346+
Self.nativelyExposedInstanceReferenceCounter[key] = referenceCount
6347+
}
6348+
if referenceCount == 1 {
6349+
print("Caching global instance \(key). Cached instance count: \(nativelyExposedInstanceReferenceCounter.count)")
6350+
Self.nativelyExposedInstances[key] = instance
6351+
}
6352+
}
63246353

6325-
public class func instanceToPointer(instance: NativeTypeWrapper) -> UnsafeMutableRawPointer {
6326-
let pointer = Unmanaged.passUnretained(instance).toOpaque()
6327-
instance.pointerDebugDescription = pointer.debugDescription
6328-
Self.nativelyExposedInstances[pointer.debugDescription] = instance
6354+
public class func instanceToPointer(instance: NativeTraitWrapper) -> UnsafeMutableRawPointer {
6355+
let key = instance.globalInstanceNumber
6356+
let pointer = UnsafeMutableRawPointer(bitPattern: key)!
6357+
// don't automatically cache the trait instance
6358+
// Self.nativelyExposedInstances[instance.globalInstanceNumber] = instance
63296359
return pointer
63306360
}
63316361

6332-
public class func pointerToInstance<T: NativeTypeWrapper>(pointer: UnsafeRawPointer, sourceMarker: String?) -> T{
6333-
6334-
let callStack = Thread.callStackSymbols
6335-
let caller = sourceMarker ?? callStack[1]
6336-
// print("Retrieving instance from pointer for caller: \(caller)")
6337-
// let value = Unmanaged<T>.fromOpaque(pointer).takeUnretainedValue()
6338-
let value = Self.nativelyExposedInstances[pointer.debugDescription] as! T
6339-
// print("Instance retrieved for caller: \(caller)")
6362+
public class func pointerToInstance<T: NativeTraitWrapper>(pointer: UnsafeRawPointer, sourceMarker: String?) -> T{
6363+
let key = UInt(bitPattern: pointer)
6364+
let referenceCount = Self.nativelyExposedInstanceReferenceCounter[key] ?? 0
6365+
if referenceCount < 1 {
6366+
print("Bad lookup: non-positive reference count for instance \(key): \(referenceCount)!", severity: .ERROR)
6367+
}
6368+
let value = Self.nativelyExposedInstances[key] as! T
63406369
return value
63416370
}
63426371

6343-
public class func removeInstancePointer(instance: NativeTypeWrapper) -> Bool {
6344-
guard let debugDescription = instance.pointerDebugDescription else {
6345-
return false
6372+
public class func removeInstancePointer(instance: NativeTraitWrapper) -> Bool {
6373+
let key = instance.globalInstanceNumber
6374+
let referenceCount = (Self.nativelyExposedInstanceReferenceCounter[key] ?? 0) - 1
6375+
Self.nativelyExposedInstanceReferenceCounter[key] = referenceCount
6376+
if referenceCount == 0 {
6377+
print("Uncaching global instance \(key)")
6378+
// TODO: fix counting
6379+
Self.nativelyExposedInstances.removeValue(forKey: key)
6380+
instance.pointerDebugDescription = nil
6381+
} else if referenceCount < 0 {
6382+
print("Bad uncache: negative reference count (\(referenceCount)) for instance \(key)!", severity: .ERROR)
63466383
}
6347-
Self.nativelyExposedInstances.removeValue(forKey: debugDescription)
6348-
instance.pointerDebugDescription = nil
63496384
return true
63506385
}
63516386

@@ -6429,7 +6464,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
64296464
}
64306465
/* RUST_TO_SWIFT_END */
64316466

6432-
public class func LDKStr_to_string(nativeType: LDKStr) -> String {
6467+
public class func LDKStr_to_string(nativeType: LDKStr, deallocate: Bool = true) -> String {
64336468
var array = [UInt8]()
64346469
for index in 0..<Int(nativeType.len) {
64356470
let currentEntry = nativeType.chars[index]
@@ -6438,6 +6473,9 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
64386473
}
64396474
let data = Data(bytes: array)
64406475
let string = String(data: data, encoding: .utf8)!
6476+
if deallocate && nativeType.len > 0{
6477+
Str_free(nativeType)
6478+
}
64416479
return string
64426480
}
64436481

@@ -6471,7 +6509,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
64716509
let nativeKeysManager = keysManager.cOpaqueStruct!
64726510
let amount = Option_u64Z(value: amountMsat)
64736511
let nativeAmount = amount.cOpaqueStruct!
6474-
let nativeDescription = Self.new_LDKStr(string: description)
6512+
let nativeDescription = Self.new_LDKStr(string: description, chars_is_owned: true)
64756513
return withUnsafePointer(to: channelManager.cOpaqueStruct!) { (pointer: UnsafePointer<LDKChannelManager>) -> Result_InvoiceSignOrCreationErrorZ in
64766514
let nativeResult = create_invoice_from_channelmanager(pointer, nativeKeysManager, network, nativeAmount, nativeDescription)
64776515
return Result_InvoiceSignOrCreationErrorZ(pointer: nativeResult)
@@ -6488,14 +6526,14 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
64886526
}
64896527
}
64906528
*/
6491-
6529+
64926530
public class func get_ldk_swift_bindings_version() -> String {
6493-
return "fe0ea5b41ca6eb7ef88a4d2fbd7dc1f647c89112"
6531+
return "90b85905ad0889a5368bb8eee79bfbb4d0ff444e"
64946532
}
64956533

64966534
}
64976535

6498-
public class InstanceCrashSimulator: NativeTypeWrapper {
6536+
public class InstanceCrashSimulator: NativeTraitWrapper {
64996537

65006538
public init() {
65016539
super.init(conflictAvoidingVariableName: 0)

bindings/LDK/options/APIError.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,22 +120,22 @@ APIError_clone(origPointer)
120120

121121
public class func apimisuse_error(err: String) -> APIError {
122122

123-
return APIError(pointer: APIError_apimisuse_error(Bindings.new_LDKStr(string: err)));
123+
return APIError(pointer: APIError_apimisuse_error(Bindings.new_LDKStr(string: err, chars_is_owned: true)));
124124
}
125125

126126
public class func fee_rate_too_high(err: String, feerate: UInt32) -> APIError {
127127

128-
return APIError(pointer: APIError_fee_rate_too_high(Bindings.new_LDKStr(string: err), feerate));
128+
return APIError(pointer: APIError_fee_rate_too_high(Bindings.new_LDKStr(string: err, chars_is_owned: true), feerate));
129129
}
130130

131131
public class func route_error(err: String) -> APIError {
132132

133-
return APIError(pointer: APIError_route_error(Bindings.new_LDKStr(string: err)));
133+
return APIError(pointer: APIError_route_error(Bindings.new_LDKStr(string: err, chars_is_owned: true)));
134134
}
135135

136136
public class func channel_unavailable(err: String) -> APIError {
137137

138-
return APIError(pointer: APIError_channel_unavailable(Bindings.new_LDKStr(string: err)));
138+
return APIError(pointer: APIError_channel_unavailable(Bindings.new_LDKStr(string: err, chars_is_owned: true)));
139139
}
140140

141141
public class func monitor_update_failed() -> APIError {

bindings/LDK/options/ClosureReason.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ ClosureReason_clone(origPointer)
9393

9494
public class func counterparty_force_closed(peer_msg: String) -> ClosureReason {
9595

96-
return ClosureReason(pointer: ClosureReason_counterparty_force_closed(Bindings.new_LDKStr(string: peer_msg)));
96+
return ClosureReason(pointer: ClosureReason_counterparty_force_closed(Bindings.new_LDKStr(string: peer_msg, chars_is_owned: true)));
9797
}
9898

9999
public class func holder_force_closed() -> ClosureReason {
@@ -118,7 +118,7 @@ ClosureReason_clone(origPointer)
118118

119119
public class func processing_error(err: String) -> ClosureReason {
120120

121-
return ClosureReason(pointer: ClosureReason_processing_error(Bindings.new_LDKStr(string: err)));
121+
return ClosureReason(pointer: ClosureReason_processing_error(Bindings.new_LDKStr(string: err, chars_is_owned: true)));
122122
}
123123

124124
public class func disconnected_peer() -> ClosureReason {

bindings/LDK/options/MonitorEvent.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class MonitorEvent: NativeTypeWrapper {
6363
self.cOpaqueStruct!.commitment_tx_confirmed;
6464
if cStruct.inner == nil {
6565
return nil
66-
}
66+
}
6767
return OutPoint(pointer: cStruct, anchor: self)
6868
}()
6969

@@ -86,7 +86,7 @@ public class MonitorEvent: NativeTypeWrapper {
8686
self.cOpaqueStruct!.update_failed;
8787
if cStruct.inner == nil {
8888
return nil
89-
}
89+
}
9090
return OutPoint(pointer: cStruct, anchor: self)
9191
}()
9292

@@ -192,7 +192,7 @@ MonitorEvent_write(objPointer)
192192
self.cOpaqueStruct!.funding_txo;
193193
if cStruct.inner == nil {
194194
return nil
195-
}
195+
}
196196
return OutPoint(pointer: cStruct, anchor: self)
197197
}()
198198

bindings/LDK/options/Option_AccessZ.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class Option_AccessZ: NativeTypeWrapper {
5959

6060
public class func some(o: Access) -> Option_AccessZ {
6161

62-
return Option_AccessZ(pointer: COption_AccessZ_some(o.cOpaqueStruct!));
62+
return Option_AccessZ(pointer: COption_AccessZ_some(o.activate().cOpaqueStruct!));
6363
}
6464

6565
public class func none() -> Option_AccessZ {

bindings/LDK/options/Option_FilterZ.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class Option_FilterZ: NativeTypeWrapper {
5959

6060
public class func some(o: Filter) -> Option_FilterZ {
6161

62-
return Option_FilterZ(pointer: COption_FilterZ_some(o.cOpaqueStruct!));
62+
return Option_FilterZ(pointer: COption_FilterZ_some(o.activate().cOpaqueStruct!));
6363
}
6464

6565
public class func none() -> Option_FilterZ {

bindings/LDK/options/ParseError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ ParseError_clone(origPointer)
190190

191191
public class func invalid_slice_length(a: String) -> ParseError {
192192

193-
return ParseError(pointer: ParseError_invalid_slice_length(Bindings.new_LDKStr(string: a)));
193+
return ParseError(pointer: ParseError_invalid_slice_length(Bindings.new_LDKStr(string: a, chars_is_owned: true)));
194194
}
195195

196196
public class func skip() -> ParseError {

bindings/LDK/options/PaymentError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ PaymentError_clone(origPointer)
102102

103103
public class func invoice(a: String) -> PaymentError {
104104

105-
return PaymentError(pointer: PaymentError_invoice(Bindings.new_LDKStr(string: a)));
105+
return PaymentError(pointer: PaymentError_invoice(Bindings.new_LDKStr(string: a, chars_is_owned: true)));
106106
}
107107

108108
public class func routing(a: LightningError) -> PaymentError {

0 commit comments

Comments
 (0)