Skip to content

Commit

Permalink
error field on each incoming msg
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanfeenstra committed Jun 10, 2024
1 parent d540123 commit a3083b7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sphinx-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sphinx-signer = { path = "../signer", default-features = false, features = [
"no-native",
] }
sphinx-glyph = { path = "../glyph", default-features = false }
sphinx = { git = "https://github.com/stakwork/sphinx", rev = "b51771ba9a8b5e4742cc8818136410a8f719ba17", features = [
sphinx = { git = "https://github.com/stakwork/sphinx", rev = "2735386f05f10d8dac3b7db414d3fc6ac4f3b210", features = [
"msg",
"bindings",
] }
Expand Down
2 changes: 2 additions & 0 deletions sphinx-ffi/src/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub struct Msg {
pub sent_to: Option<String>,
pub from_me: Option<bool>,
pub payment_hash: Option<String>,
pub error: Option<String>,
}

pub struct ParsedInvite {
Expand Down Expand Up @@ -761,6 +762,7 @@ impl From<bindings::Msg> for Msg {
sent_to: rr.sent_to,
from_me: rr.from_me,
payment_hash: rr.payment_hash,
error: rr.error,
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions sphinx-ffi/src/sphinxrs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,11 @@ public struct Msg {
public var `sentTo`: String?
public var `fromMe`: Bool?
public var `paymentHash`: String?
public var `error`: String?

// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(`message`: String?, `type`: UInt8?, `uuid`: String?, `tag`: String?, `index`: String?, `sender`: String?, `msat`: UInt64?, `timestamp`: UInt64?, `sentTo`: String?, `fromMe`: Bool?, `paymentHash`: String?) {
public init(`message`: String?, `type`: UInt8?, `uuid`: String?, `tag`: String?, `index`: String?, `sender`: String?, `msat`: UInt64?, `timestamp`: UInt64?, `sentTo`: String?, `fromMe`: Bool?, `paymentHash`: String?, `error`: String?) {
self.`message` = `message`
self.`type` = `type`
self.`uuid` = `uuid`
Expand All @@ -502,6 +503,7 @@ public struct Msg {
self.`sentTo` = `sentTo`
self.`fromMe` = `fromMe`
self.`paymentHash` = `paymentHash`
self.`error` = `error`
}
}

Expand Down Expand Up @@ -541,6 +543,9 @@ extension Msg: Equatable, Hashable {
if lhs.`paymentHash` != rhs.`paymentHash` {
return false
}
if lhs.`error` != rhs.`error` {
return false
}
return true
}

Expand All @@ -556,6 +561,7 @@ extension Msg: Equatable, Hashable {
hasher.combine(`sentTo`)
hasher.combine(`fromMe`)
hasher.combine(`paymentHash`)
hasher.combine(`error`)
}
}

Expand All @@ -573,7 +579,8 @@ public struct FfiConverterTypeMsg: FfiConverterRustBuffer {
`timestamp`: FfiConverterOptionUInt64.read(from: &buf),
`sentTo`: FfiConverterOptionString.read(from: &buf),
`fromMe`: FfiConverterOptionBool.read(from: &buf),
`paymentHash`: FfiConverterOptionString.read(from: &buf)
`paymentHash`: FfiConverterOptionString.read(from: &buf),
`error`: FfiConverterOptionString.read(from: &buf)
)
}

Expand All @@ -589,6 +596,7 @@ public struct FfiConverterTypeMsg: FfiConverterRustBuffer {
FfiConverterOptionString.write(value.`sentTo`, into: &buf)
FfiConverterOptionBool.write(value.`fromMe`, into: &buf)
FfiConverterOptionString.write(value.`paymentHash`, into: &buf)
FfiConverterOptionString.write(value.`error`, into: &buf)
}
}

Expand Down
1 change: 1 addition & 0 deletions sphinx-ffi/src/sphinxrs.udl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dictionary Msg {
string? sent_to;
boolean? from_me;
string? payment_hash;
string? error;
};

dictionary ParsedInvite {
Expand Down

0 comments on commit a3083b7

Please sign in to comment.