session_privs: HashSet<[u8; 32]>,
},
Retryable {
+ retry_strategy: Retry,
+ attempts: PaymentAttempts,
+ route_params: Option<RouteParameters>,
session_privs: HashSet<[u8; 32]>,
payment_hash: PaymentHash,
payment_secret: Option<PaymentSecret>,
}
impl PendingOutboundPayment {
+ fn increment_attempts(&mut self) {
+ if let PendingOutboundPayment::Retryable { attempts, .. } = self {
+ attempts.count += 1;
+ }
+ }
+ fn is_retryable_now(&self) -> bool {
+ if let PendingOutboundPayment::Retryable { retry_strategy, attempts, .. } = self {
+ return retry_strategy.is_retryable_now(&attempts)
+ }
+ false
+ }
pub(super) fn is_fulfilled(&self) -> bool {
match self {
PendingOutboundPayment::Fulfilled { .. } => true,
hash_map::Entry::Occupied(_) => Err(PaymentSendFailure::DuplicatePayment),
hash_map::Entry::Vacant(entry) => {
let payment = entry.insert(PendingOutboundPayment::Retryable {
+ retry_strategy,
+ attempts: PaymentAttempts::new(),
+ route_params,
session_privs: HashSet::new(),
pending_amt_msat: 0,
pending_fee_msat: Some(0),
(0, session_privs, required),
(1, pending_fee_msat, option),
(2, payment_hash, required),
+ (not_written, retry_strategy, (static_value, Retry::Attempts(0))),
(4, payment_secret, option),
+ (not_written, attempts, (static_value, PaymentAttempts::new())),
(6, total_msat, required),
+ (not_written, route_params, (static_value, None)),
(8, pending_amt_msat, required),
(10, starting_block_height, required),
},