-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow LDK node to send payjoin transactions #295
base: main
Are you sure you want to change the base?
Changes from all commits
1775b2e
9dec96d
ce87a44
56b1660
cf788ef
fbc83fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,15 @@ pub(crate) const RESOLVED_CHANNEL_MONITOR_ARCHIVAL_INTERVAL: u32 = 6; | |
// The time in-between peer reconnection attempts. | ||
pub(crate) const PEER_RECONNECTION_INTERVAL: Duration = Duration::from_secs(10); | ||
|
||
// The time before a payjoin http request is considered timed out. | ||
pub(crate) const PAYJOIN_REQUEST_TIMEOUT: Duration = Duration::from_secs(30); | ||
|
||
// The duration between retries of a payjoin http request. | ||
pub(crate) const PAYJOIN_RETRY_INTERVAL: Duration = Duration::from_secs(3); | ||
|
||
// The total duration of retrying to send a payjoin http request. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment isn't very helpful. What does 'total duration of retrying' mean? Do we abort the flow afterwards, or do we just give up? |
||
pub(crate) const PAYJOIN_REQUEST_TOTAL_DURATION: Duration = Duration::from_secs(24 * 60 * 60); | ||
|
||
// The time in-between RGS sync attempts. | ||
pub(crate) const RGS_SYNC_INTERVAL: Duration = Duration::from_secs(60 * 60); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,6 +114,18 @@ pub enum Error { | |
LiquiditySourceUnavailable, | ||
/// The given operation failed due to the LSP's required opening fee being too high. | ||
LiquidityFeeTooHigh, | ||
/// Failed to access Payjoin object. | ||
PayjoinUnavailable, | ||
/// Payjoin URI is invalid. | ||
PayjoinUriInvalid, | ||
/// Amount is neither user-provided nor defined in the URI. | ||
PayjoinRequestMissingAmount, | ||
/// Failed to build a Payjoin request. | ||
PayjoinRequestCreationFailed, | ||
/// Failed to send Payjoin request. | ||
PayjoinRequestSendingFailed, | ||
/// Payjoin response processing failed. | ||
PayjoinResponseProcessingFailed, | ||
} | ||
|
||
impl fmt::Display for Error { | ||
|
@@ -184,6 +196,30 @@ impl fmt::Display for Error { | |
Self::LiquidityFeeTooHigh => { | ||
write!(f, "The given operation failed due to the LSP's required opening fee being too high.") | ||
}, | ||
Self::PayjoinUnavailable => { | ||
write!( | ||
f, | ||
"Failed to access Payjoin object. Make sure you have enabled Payjoin support." | ||
) | ||
}, | ||
Self::PayjoinRequestMissingAmount => { | ||
write!( | ||
f, | ||
"Amount is neither user-provided nor defined in the provided Payjoin URI." | ||
) | ||
}, | ||
Self::PayjoinRequestCreationFailed => { | ||
write!(f, "Failed construct a Payjoin request") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Please end all messages with a |
||
}, | ||
Self::PayjoinUriInvalid => { | ||
write!(f, "The provided Payjoin URI is invalid") | ||
}, | ||
Self::PayjoinRequestSendingFailed => { | ||
write!(f, "Failed to send Payjoin request") | ||
}, | ||
Self::PayjoinResponseProcessingFailed => { | ||
write!(f, "Payjoin receiver responded to our request with an invalid response") | ||
}, | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
s/http/HTTP/
here and below.