]> git.bitcoin.ninja Git - ldk-c-bindings/blobdiff - lightning-c-bindings/src/lightning/routing/scoring.rs
Add missing `rustc` `metadata` override for `lightning_types`
[ldk-c-bindings] / lightning-c-bindings / src / lightning / routing / scoring.rs
index 3ebead9588bc9b33069908e68f2ec8c32ebdc25c..59e0e98592c272876833cc4743536b5f39858ae5 100644 (file)
@@ -25,7 +25,7 @@
 //! #
 //! # struct FakeLogger {};
 //! # impl Logger for FakeLogger {
 //! #
 //! # struct FakeLogger {};
 //! # impl Logger for FakeLogger {
-//! #     fn log(&self, record: &Record) { unimplemented!() }
+//! #     fn log(&self, record: Record) { unimplemented!() }
 //! # }
 //! # fn find_scored_route(payer: PublicKey, route_params: RouteParameters, network_graph: NetworkGraph<&FakeLogger>) {
 //! # let logger = FakeLogger {};
 //! # }
 //! # fn find_scored_route(payer: PublicKey, route_params: RouteParameters, network_graph: NetworkGraph<&FakeLogger>) {
 //! # let logger = FakeLogger {};
 //! # }
 //! ```
 //!
 //! # }
 //! ```
 //!
-//! # Note
-//!
-//! Persisting when built with feature `no-std` and restoring without it, or vice versa, uses
-//! different types and thus is undefined.
-//!
 //! [`find_route`]: crate::routing::router::find_route
 
 use alloc::str::FromStr;
 //! [`find_route`]: crate::routing::router::find_route
 
 use alloc::str::FromStr;
@@ -82,7 +77,7 @@ pub struct ScoreLookUp {
        /// such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
        /// [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
        /// Thus, implementations should be overflow-safe.
        /// such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
        /// [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
        /// Thus, implementations should be overflow-safe.
-       pub channel_penalty_msat: extern "C" fn (this_arg: *const c_void, short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64,
+       pub channel_penalty_msat: extern "C" fn (this_arg: *const c_void, candidate: &crate::lightning::routing::router::CandidateRouteHop, usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64,
        /// Frees any resources associated with this object given its this_arg pointer.
        /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
        pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
        /// Frees any resources associated with this object given its this_arg pointer.
        /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
        pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
@@ -100,8 +95,16 @@ pub(crate) fn ScoreLookUp_clone_fields(orig: &ScoreLookUp) -> ScoreLookUp {
 
 use lightning::routing::scoring::ScoreLookUp as rustScoreLookUp;
 impl rustScoreLookUp for ScoreLookUp {
 
 use lightning::routing::scoring::ScoreLookUp as rustScoreLookUp;
 impl rustScoreLookUp for ScoreLookUp {
-       fn channel_penalty_msat(&self, mut short_channel_id: u64, mut source: &lightning::routing::gossip::NodeId, mut target: &lightning::routing::gossip::NodeId, mut usage: lightning::routing::scoring::ChannelUsage, mut score_params: &lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
-               let mut ret = (self.channel_penalty_msat)(self.this_arg, short_channel_id, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((source as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((target as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, crate::lightning::routing::scoring::ChannelUsage { inner: ObjOps::heap_alloc(usage), is_owned: true }, &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((score_params as *const lightning::routing::scoring::ProbabilisticScoringFeeParameters<>) as *mut _) }, is_owned: false });
+       fn channel_penalty_msat(&self, mut candidate: &lightning::routing::router::CandidateRouteHop, mut usage: lightning::routing::scoring::ChannelUsage, mut score_params: &lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
+               let mut ret = (self.channel_penalty_msat)(self.this_arg, &crate::lightning::routing::router::CandidateRouteHop::from_native(candidate), crate::lightning::routing::scoring::ChannelUsage { inner: ObjOps::heap_alloc(usage), is_owned: true }, &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((score_params as *const lightning::routing::scoring::ProbabilisticScoringFeeParameters<>) as *mut _) }, is_owned: false });
+               ret
+       }
+}
+
+pub struct ScoreLookUpRef(ScoreLookUp);
+impl rustScoreLookUp for ScoreLookUpRef {
+       fn channel_penalty_msat(&self, mut candidate: &lightning::routing::router::CandidateRouteHop, mut usage: lightning::routing::scoring::ChannelUsage, mut score_params: &lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
+               let mut ret = (self.0.channel_penalty_msat)(self.0.this_arg, &crate::lightning::routing::router::CandidateRouteHop::from_native(candidate), crate::lightning::routing::scoring::ChannelUsage { inner: ObjOps::heap_alloc(usage), is_owned: true }, &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((score_params as *const lightning::routing::scoring::ProbabilisticScoringFeeParameters<>) as *mut _) }, is_owned: false });
                ret
        }
 }
                ret
        }
 }
@@ -109,14 +112,14 @@ impl rustScoreLookUp for ScoreLookUp {
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
 impl core::ops::Deref for ScoreLookUp {
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
 impl core::ops::Deref for ScoreLookUp {
-       type Target = Self;
-       fn deref(&self) -> &Self {
-               self
+       type Target = ScoreLookUpRef;
+       fn deref(&self) -> &Self::Target {
+               unsafe { &*(self as *const _ as *const ScoreLookUpRef) }
        }
 }
 impl core::ops::DerefMut for ScoreLookUp {
        }
 }
 impl core::ops::DerefMut for ScoreLookUp {
-       fn deref_mut(&mut self) -> &mut Self {
-               self
+       fn deref_mut(&mut self) -> &mut ScoreLookUpRef {
+               unsafe { &mut *(self as *mut _ as *mut ScoreLookUpRef) }
        }
 }
 /// Calls the free function if one is set
        }
 }
 /// Calls the free function if one is set
@@ -136,13 +139,18 @@ pub struct ScoreUpdate {
        /// This has no meaning in the LDK, and can be NULL or any other value.
        pub this_arg: *mut c_void,
        /// Handles updating channel penalties after failing to route through a channel.
        /// This has no meaning in the LDK, and can be NULL or any other value.
        pub this_arg: *mut c_void,
        /// Handles updating channel penalties after failing to route through a channel.
-       pub payment_path_failed: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, short_channel_id: u64),
+       pub payment_path_failed: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, short_channel_id: u64, duration_since_epoch: u64),
        /// Handles updating channel penalties after successfully routing along a path.
        /// Handles updating channel penalties after successfully routing along a path.
-       pub payment_path_successful: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path),
+       pub payment_path_successful: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, duration_since_epoch: u64),
        /// Handles updating channel penalties after a probe over the given path failed.
        /// Handles updating channel penalties after a probe over the given path failed.
-       pub probe_failed: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, short_channel_id: u64),
+       pub probe_failed: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, short_channel_id: u64, duration_since_epoch: u64),
        /// Handles updating channel penalties after a probe over the given path succeeded.
        /// Handles updating channel penalties after a probe over the given path succeeded.
-       pub probe_successful: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path),
+       pub probe_successful: extern "C" fn (this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, duration_since_epoch: u64),
+       /// Scorers may wish to reduce their certainty of channel liquidity information over time.
+       /// Thus, this method is provided to allow scorers to observe the passage of time - the holder
+       /// of this object should call this method regularly (generally via the
+       /// `lightning-background-processor` crate).
+       pub time_passed: extern "C" fn (this_arg: *mut c_void, duration_since_epoch: u64),
        /// Frees any resources associated with this object given its this_arg pointer.
        /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
        pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
        /// Frees any resources associated with this object given its this_arg pointer.
        /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
        pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
@@ -157,37 +165,60 @@ pub(crate) fn ScoreUpdate_clone_fields(orig: &ScoreUpdate) -> ScoreUpdate {
                payment_path_successful: Clone::clone(&orig.payment_path_successful),
                probe_failed: Clone::clone(&orig.probe_failed),
                probe_successful: Clone::clone(&orig.probe_successful),
                payment_path_successful: Clone::clone(&orig.payment_path_successful),
                probe_failed: Clone::clone(&orig.probe_failed),
                probe_successful: Clone::clone(&orig.probe_successful),
+               time_passed: Clone::clone(&orig.time_passed),
                free: Clone::clone(&orig.free),
        }
 }
 
 use lightning::routing::scoring::ScoreUpdate as rustScoreUpdate;
 impl rustScoreUpdate for ScoreUpdate {
                free: Clone::clone(&orig.free),
        }
 }
 
 use lightning::routing::scoring::ScoreUpdate as rustScoreUpdate;
 impl rustScoreUpdate for ScoreUpdate {
-       fn payment_path_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64) {
-               (self.payment_path_failed)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id)
+       fn payment_path_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: core::time::Duration) {
+               (self.payment_path_failed)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id, duration_since_epoch.as_secs())
        }
        }
-       fn payment_path_successful(&mut self, mut path: &lightning::routing::router::Path) {
-               (self.payment_path_successful)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false })
+       fn payment_path_successful(&mut self, mut path: &lightning::routing::router::Path, mut duration_since_epoch: core::time::Duration) {
+               (self.payment_path_successful)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, duration_since_epoch.as_secs())
        }
        }
-       fn probe_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64) {
-               (self.probe_failed)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id)
+       fn probe_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: core::time::Duration) {
+               (self.probe_failed)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id, duration_since_epoch.as_secs())
        }
        }
-       fn probe_successful(&mut self, mut path: &lightning::routing::router::Path) {
-               (self.probe_successful)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false })
+       fn probe_successful(&mut self, mut path: &lightning::routing::router::Path, mut duration_since_epoch: core::time::Duration) {
+               (self.probe_successful)(self.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, duration_since_epoch.as_secs())
+       }
+       fn time_passed(&mut self, mut duration_since_epoch: core::time::Duration) {
+               (self.time_passed)(self.this_arg, duration_since_epoch.as_secs())
+       }
+}
+
+pub struct ScoreUpdateRef(ScoreUpdate);
+impl rustScoreUpdate for ScoreUpdateRef {
+       fn payment_path_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: core::time::Duration) {
+               (self.0.payment_path_failed)(self.0.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id, duration_since_epoch.as_secs())
+       }
+       fn payment_path_successful(&mut self, mut path: &lightning::routing::router::Path, mut duration_since_epoch: core::time::Duration) {
+               (self.0.payment_path_successful)(self.0.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, duration_since_epoch.as_secs())
+       }
+       fn probe_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: core::time::Duration) {
+               (self.0.probe_failed)(self.0.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id, duration_since_epoch.as_secs())
+       }
+       fn probe_successful(&mut self, mut path: &lightning::routing::router::Path, mut duration_since_epoch: core::time::Duration) {
+               (self.0.probe_successful)(self.0.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, duration_since_epoch.as_secs())
+       }
+       fn time_passed(&mut self, mut duration_since_epoch: core::time::Duration) {
+               (self.0.time_passed)(self.0.this_arg, duration_since_epoch.as_secs())
        }
 }
 
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
 impl core::ops::Deref for ScoreUpdate {
        }
 }
 
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
 impl core::ops::Deref for ScoreUpdate {
-       type Target = Self;
-       fn deref(&self) -> &Self {
-               self
+       type Target = ScoreUpdateRef;
+       fn deref(&self) -> &Self::Target {
+               unsafe { &*(self as *const _ as *const ScoreUpdateRef) }
        }
 }
 impl core::ops::DerefMut for ScoreUpdate {
        }
 }
 impl core::ops::DerefMut for ScoreUpdate {
-       fn deref_mut(&mut self) -> &mut Self {
-               self
+       fn deref_mut(&mut self) -> &mut ScoreUpdateRef {
+               unsafe { &mut *(self as *mut _ as *mut ScoreUpdateRef) }
        }
 }
 /// Calls the free function if one is set
        }
 }
 /// Calls the free function if one is set
@@ -234,23 +265,49 @@ pub(crate) fn Score_clone_fields(orig: &Score) -> Score {
        }
 }
 impl lightning::routing::scoring::ScoreLookUp for Score {
        }
 }
 impl lightning::routing::scoring::ScoreLookUp for Score {
-       fn channel_penalty_msat(&self, mut short_channel_id: u64, mut source: &lightning::routing::gossip::NodeId, mut target: &lightning::routing::gossip::NodeId, mut usage: lightning::routing::scoring::ChannelUsage, mut score_params: &lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
-               let mut ret = (self.ScoreLookUp.channel_penalty_msat)(self.ScoreLookUp.this_arg, short_channel_id, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((source as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, &crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((target as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false }, crate::lightning::routing::scoring::ChannelUsage { inner: ObjOps::heap_alloc(usage), is_owned: true }, &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((score_params as *const lightning::routing::scoring::ProbabilisticScoringFeeParameters<>) as *mut _) }, is_owned: false });
+       fn channel_penalty_msat(&self, mut candidate: &lightning::routing::router::CandidateRouteHop, mut usage: lightning::routing::scoring::ChannelUsage, mut score_params: &lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
+               let mut ret = (self.ScoreLookUp.channel_penalty_msat)(self.ScoreLookUp.this_arg, &crate::lightning::routing::router::CandidateRouteHop::from_native(candidate), crate::lightning::routing::scoring::ChannelUsage { inner: ObjOps::heap_alloc(usage), is_owned: true }, &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((score_params as *const lightning::routing::scoring::ProbabilisticScoringFeeParameters<>) as *mut _) }, is_owned: false });
+               ret
+       }
+}
+impl lightning::routing::scoring::ScoreLookUp for ScoreRef {
+       fn channel_penalty_msat(&self, mut candidate: &lightning::routing::router::CandidateRouteHop, mut usage: lightning::routing::scoring::ChannelUsage, mut score_params: &lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
+               let mut ret = (self.0.ScoreLookUp.channel_penalty_msat)(self.0.ScoreLookUp.this_arg, &crate::lightning::routing::router::CandidateRouteHop::from_native(candidate), crate::lightning::routing::scoring::ChannelUsage { inner: ObjOps::heap_alloc(usage), is_owned: true }, &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((score_params as *const lightning::routing::scoring::ProbabilisticScoringFeeParameters<>) as *mut _) }, is_owned: false });
                ret
        }
 }
 impl lightning::routing::scoring::ScoreUpdate for Score {
                ret
        }
 }
 impl lightning::routing::scoring::ScoreUpdate for Score {
-       fn payment_path_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64) {
-               (self.ScoreUpdate.payment_path_failed)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id)
+       fn payment_path_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: core::time::Duration) {
+               (self.ScoreUpdate.payment_path_failed)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id, duration_since_epoch.as_secs())
+       }
+       fn payment_path_successful(&mut self, mut path: &lightning::routing::router::Path, mut duration_since_epoch: core::time::Duration) {
+               (self.ScoreUpdate.payment_path_successful)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, duration_since_epoch.as_secs())
        }
        }
-       fn payment_path_successful(&mut self, mut path: &lightning::routing::router::Path) {
-               (self.ScoreUpdate.payment_path_successful)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false })
+       fn probe_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: core::time::Duration) {
+               (self.ScoreUpdate.probe_failed)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id, duration_since_epoch.as_secs())
        }
        }
-       fn probe_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64) {
-               (self.ScoreUpdate.probe_failed)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id)
+       fn probe_successful(&mut self, mut path: &lightning::routing::router::Path, mut duration_since_epoch: core::time::Duration) {
+               (self.ScoreUpdate.probe_successful)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, duration_since_epoch.as_secs())
        }
        }
-       fn probe_successful(&mut self, mut path: &lightning::routing::router::Path) {
-               (self.ScoreUpdate.probe_successful)(self.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false })
+       fn time_passed(&mut self, mut duration_since_epoch: core::time::Duration) {
+               (self.ScoreUpdate.time_passed)(self.ScoreUpdate.this_arg, duration_since_epoch.as_secs())
+       }
+}
+impl lightning::routing::scoring::ScoreUpdate for ScoreRef {
+       fn payment_path_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: core::time::Duration) {
+               (self.0.ScoreUpdate.payment_path_failed)(self.0.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id, duration_since_epoch.as_secs())
+       }
+       fn payment_path_successful(&mut self, mut path: &lightning::routing::router::Path, mut duration_since_epoch: core::time::Duration) {
+               (self.0.ScoreUpdate.payment_path_successful)(self.0.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, duration_since_epoch.as_secs())
+       }
+       fn probe_failed(&mut self, mut path: &lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: core::time::Duration) {
+               (self.0.ScoreUpdate.probe_failed)(self.0.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, short_channel_id, duration_since_epoch.as_secs())
+       }
+       fn probe_successful(&mut self, mut path: &lightning::routing::router::Path, mut duration_since_epoch: core::time::Duration) {
+               (self.0.ScoreUpdate.probe_successful)(self.0.ScoreUpdate.this_arg, &crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((path as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false }, duration_since_epoch.as_secs())
+       }
+       fn time_passed(&mut self, mut duration_since_epoch: core::time::Duration) {
+               (self.0.ScoreUpdate.time_passed)(self.0.ScoreUpdate.this_arg, duration_since_epoch.as_secs())
        }
 }
 impl lightning::util::ser::Writeable for Score {
        }
 }
 impl lightning::util::ser::Writeable for Score {
@@ -259,22 +316,32 @@ impl lightning::util::ser::Writeable for Score {
                w.write_all(vec.as_slice())
        }
 }
                w.write_all(vec.as_slice())
        }
 }
+impl lightning::util::ser::Writeable for ScoreRef {
+       fn write<W: lightning::util::ser::Writer>(&self, w: &mut W) -> Result<(), crate::c_types::io::Error> {
+               let vec = (self.0.write)(self.0.this_arg);
+               w.write_all(vec.as_slice())
+       }
+}
 
 use lightning::routing::scoring::Score as rustScore;
 impl rustScore for Score {
 }
 
 
 use lightning::routing::scoring::Score as rustScore;
 impl rustScore for Score {
 }
 
+pub struct ScoreRef(Score);
+impl rustScore for ScoreRef {
+}
+
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
 impl core::ops::Deref for Score {
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
 impl core::ops::Deref for Score {
-       type Target = Self;
-       fn deref(&self) -> &Self {
-               self
+       type Target = ScoreRef;
+       fn deref(&self) -> &Self::Target {
+               unsafe { &*(self as *const _ as *const ScoreRef) }
        }
 }
 impl core::ops::DerefMut for Score {
        }
 }
 impl core::ops::DerefMut for Score {
-       fn deref_mut(&mut self) -> &mut Self {
-               self
+       fn deref_mut(&mut self) -> &mut ScoreRef {
+               unsafe { &mut *(self as *mut _ as *mut ScoreRef) }
        }
 }
 /// Calls the free function if one is set
        }
 }
 /// Calls the free function if one is set
@@ -321,9 +388,9 @@ pub(crate) fn LockableScore_clone_fields(orig: &LockableScore) -> LockableScore
 }
 
 use lightning::routing::scoring::LockableScore as rustLockableScore;
 }
 
 use lightning::routing::scoring::LockableScore as rustLockableScore;
-impl<'a> rustLockableScore<'a> for LockableScore {
-       type ScoreUpdate = crate::lightning::routing::scoring::ScoreUpdate;
-       type ScoreLookUp = crate::lightning::routing::scoring::ScoreLookUp;
+impl<'a> rustLockableScore<'a> for LockableScore {
+       type ScoreUpdate = crate::lightning::routing::scoring::ScoreUpdateRef;
+       type ScoreLookUp = crate::lightning::routing::scoring::ScoreLookUpRef;
        type WriteLocked = crate::lightning::routing::scoring::ScoreUpdate;
        type ReadLocked = crate::lightning::routing::scoring::ScoreLookUp;
        fn read_lock(&'a self) -> crate::lightning::routing::scoring::ScoreLookUp {
        type WriteLocked = crate::lightning::routing::scoring::ScoreUpdate;
        type ReadLocked = crate::lightning::routing::scoring::ScoreLookUp;
        fn read_lock(&'a self) -> crate::lightning::routing::scoring::ScoreLookUp {
@@ -336,17 +403,33 @@ impl<'a> rustLockableScore<'a> for LockableScore {
        }
 }
 
        }
 }
 
+pub struct LockableScoreRef(LockableScore);
+impl<'a> rustLockableScore<'a, > for LockableScoreRef {
+       type ScoreUpdate = crate::lightning::routing::scoring::ScoreUpdateRef;
+       type ScoreLookUp = crate::lightning::routing::scoring::ScoreLookUpRef;
+       type WriteLocked = crate::lightning::routing::scoring::ScoreUpdate;
+       type ReadLocked = crate::lightning::routing::scoring::ScoreLookUp;
+       fn read_lock(&'a self) -> crate::lightning::routing::scoring::ScoreLookUp {
+               let mut ret = (self.0.read_lock)(self.0.this_arg);
+               ret
+       }
+       fn write_lock(&'a self) -> crate::lightning::routing::scoring::ScoreUpdate {
+               let mut ret = (self.0.write_lock)(self.0.this_arg);
+               ret
+       }
+}
+
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
 impl core::ops::Deref for LockableScore {
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
 impl core::ops::Deref for LockableScore {
-       type Target = Self;
-       fn deref(&self) -> &Self {
-               self
+       type Target = LockableScoreRef;
+       fn deref(&self) -> &Self::Target {
+               unsafe { &*(self as *const _ as *const LockableScoreRef) }
        }
 }
 impl core::ops::DerefMut for LockableScore {
        }
 }
 impl core::ops::DerefMut for LockableScore {
-       fn deref_mut(&mut self) -> &mut Self {
-               self
+       fn deref_mut(&mut self) -> &mut LockableScoreRef {
+               unsafe { &mut *(self as *mut _ as *mut LockableScoreRef) }
        }
 }
 /// Calls the free function if one is set
        }
 }
 /// Calls the free function if one is set
@@ -387,9 +470,9 @@ pub(crate) fn WriteableScore_clone_fields(orig: &WriteableScore) -> WriteableSco
                free: Clone::clone(&orig.free),
        }
 }
                free: Clone::clone(&orig.free),
        }
 }
-impl<'a> lightning::routing::scoring::LockableScore<'a> for WriteableScore {
-       type ScoreUpdate = crate::lightning::routing::scoring::ScoreUpdate;
-       type ScoreLookUp = crate::lightning::routing::scoring::ScoreLookUp;
+impl<'a> lightning::routing::scoring::LockableScore<'a> for WriteableScore {
+       type ScoreUpdate = crate::lightning::routing::scoring::ScoreUpdateRef;
+       type ScoreLookUp = crate::lightning::routing::scoring::ScoreLookUpRef;
        type WriteLocked = crate::lightning::routing::scoring::ScoreUpdate;
        type ReadLocked = crate::lightning::routing::scoring::ScoreLookUp;
        fn read_lock(&'a self) -> crate::lightning::routing::scoring::ScoreLookUp {
        type WriteLocked = crate::lightning::routing::scoring::ScoreUpdate;
        type ReadLocked = crate::lightning::routing::scoring::ScoreLookUp;
        fn read_lock(&'a self) -> crate::lightning::routing::scoring::ScoreLookUp {
@@ -401,28 +484,52 @@ impl<'a> lightning::routing::scoring::LockableScore<'a> for WriteableScore {
                ret
        }
 }
                ret
        }
 }
+impl<'a> lightning::routing::scoring::LockableScore<'a, > for WriteableScoreRef {
+       type ScoreUpdate = crate::lightning::routing::scoring::ScoreUpdateRef;
+       type ScoreLookUp = crate::lightning::routing::scoring::ScoreLookUpRef;
+       type WriteLocked = crate::lightning::routing::scoring::ScoreUpdate;
+       type ReadLocked = crate::lightning::routing::scoring::ScoreLookUp;
+       fn read_lock(&'a self) -> crate::lightning::routing::scoring::ScoreLookUp {
+               let mut ret = (self.0.LockableScore.read_lock)(self.0.LockableScore.this_arg);
+               ret
+       }
+       fn write_lock(&'a self) -> crate::lightning::routing::scoring::ScoreUpdate {
+               let mut ret = (self.0.LockableScore.write_lock)(self.0.LockableScore.this_arg);
+               ret
+       }
+}
 impl lightning::util::ser::Writeable for WriteableScore {
        fn write<W: lightning::util::ser::Writer>(&self, w: &mut W) -> Result<(), crate::c_types::io::Error> {
                let vec = (self.write)(self.this_arg);
                w.write_all(vec.as_slice())
        }
 }
 impl lightning::util::ser::Writeable for WriteableScore {
        fn write<W: lightning::util::ser::Writer>(&self, w: &mut W) -> Result<(), crate::c_types::io::Error> {
                let vec = (self.write)(self.this_arg);
                w.write_all(vec.as_slice())
        }
 }
+impl lightning::util::ser::Writeable for WriteableScoreRef {
+       fn write<W: lightning::util::ser::Writer>(&self, w: &mut W) -> Result<(), crate::c_types::io::Error> {
+               let vec = (self.0.write)(self.0.this_arg);
+               w.write_all(vec.as_slice())
+       }
+}
 
 use lightning::routing::scoring::WriteableScore as rustWriteableScore;
 
 use lightning::routing::scoring::WriteableScore as rustWriteableScore;
-impl<'a> rustWriteableScore<'a> for WriteableScore {
+impl<'a> rustWriteableScore<'a, > for WriteableScore {
+}
+
+pub struct WriteableScoreRef(WriteableScore);
+impl<'a> rustWriteableScore<'a, > for WriteableScoreRef {
 }
 
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
 impl core::ops::Deref for WriteableScore {
 }
 
 // We're essentially a pointer already, or at least a set of pointers, so allow us to be used
 // directly as a Deref trait in higher-level structs:
 impl core::ops::Deref for WriteableScore {
-       type Target = Self;
-       fn deref(&self) -> &Self {
-               self
+       type Target = WriteableScoreRef;
+       fn deref(&self) -> &Self::Target {
+               unsafe { &*(self as *const _ as *const WriteableScoreRef) }
        }
 }
 impl core::ops::DerefMut for WriteableScore {
        }
 }
 impl core::ops::DerefMut for WriteableScore {
-       fn deref_mut(&mut self) -> &mut Self {
-               self
+       fn deref_mut(&mut self) -> &mut WriteableScoreRef {
+               unsafe { &mut *(self as *mut _ as *mut WriteableScoreRef) }
        }
 }
 /// Calls the free function if one is set
        }
 }
 /// Calls the free function if one is set
@@ -437,7 +544,7 @@ impl Drop for WriteableScore {
 }
 
 use lightning::routing::scoring::MultiThreadedLockableScore as nativeMultiThreadedLockableScoreImport;
 }
 
 use lightning::routing::scoring::MultiThreadedLockableScore as nativeMultiThreadedLockableScoreImport;
-pub(crate) type nativeMultiThreadedLockableScore = nativeMultiThreadedLockableScoreImport<crate::lightning::routing::scoring::Score>;
+pub(crate) type nativeMultiThreadedLockableScore = nativeMultiThreadedLockableScoreImport<crate::lightning::routing::scoring::Score>;
 
 /// A concrete implementation of [`LockableScore`] which supports multi-threading.
 #[must_use]
 
 /// A concrete implementation of [`LockableScore`] which supports multi-threading.
 #[must_use]
@@ -455,6 +562,12 @@ pub struct MultiThreadedLockableScore {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for MultiThreadedLockableScore {
+       type Target = nativeMultiThreadedLockableScore;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for MultiThreadedLockableScore { }
+unsafe impl core::marker::Sync for MultiThreadedLockableScore { }
 impl Drop for MultiThreadedLockableScore {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeMultiThreadedLockableScore>::is_null(self.inner) {
 impl Drop for MultiThreadedLockableScore {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeMultiThreadedLockableScore>::is_null(self.inner) {
@@ -485,6 +598,9 @@ impl MultiThreadedLockableScore {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 impl From<nativeMultiThreadedLockableScore> for crate::lightning::routing::scoring::LockableScore {
        fn from(obj: nativeMultiThreadedLockableScore) -> Self {
 }
 impl From<nativeMultiThreadedLockableScore> for crate::lightning::routing::scoring::LockableScore {
        fn from(obj: nativeMultiThreadedLockableScore) -> Self {
@@ -510,12 +626,12 @@ pub extern "C" fn MultiThreadedLockableScore_as_LockableScore(this_arg: &MultiTh
 
 #[must_use]
 extern "C" fn MultiThreadedLockableScore_LockableScore_read_lock(this_arg: *const c_void) -> crate::lightning::routing::scoring::ScoreLookUp {
 
 #[must_use]
 extern "C" fn MultiThreadedLockableScore_LockableScore_read_lock(this_arg: *const c_void) -> crate::lightning::routing::scoring::ScoreLookUp {
-       let mut ret = <nativeMultiThreadedLockableScore as lightning::routing::scoring::LockableScore<>>::read_lock(unsafe { &mut *(this_arg as *mut nativeMultiThreadedLockableScore) }, );
+       let mut ret = <nativeMultiThreadedLockableScore as lightning::routing::scoring::LockableScore<'_, >>::read_lock(unsafe { &mut *(this_arg as *mut nativeMultiThreadedLockableScore) }, );
        Into::into(ret)
 }
 #[must_use]
 extern "C" fn MultiThreadedLockableScore_LockableScore_write_lock(this_arg: *const c_void) -> crate::lightning::routing::scoring::ScoreUpdate {
        Into::into(ret)
 }
 #[must_use]
 extern "C" fn MultiThreadedLockableScore_LockableScore_write_lock(this_arg: *const c_void) -> crate::lightning::routing::scoring::ScoreUpdate {
-       let mut ret = <nativeMultiThreadedLockableScore as lightning::routing::scoring::LockableScore<>>::write_lock(unsafe { &mut *(this_arg as *mut nativeMultiThreadedLockableScore) }, );
+       let mut ret = <nativeMultiThreadedLockableScore as lightning::routing::scoring::LockableScore<'_, >>::write_lock(unsafe { &mut *(this_arg as *mut nativeMultiThreadedLockableScore) }, );
        Into::into(ret)
 }
 
        Into::into(ret)
 }
 
@@ -526,7 +642,7 @@ pub extern "C" fn MultiThreadedLockableScore_write(obj: &crate::lightning::routi
 }
 #[allow(unused)]
 pub(crate) extern "C" fn MultiThreadedLockableScore_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn MultiThreadedLockableScore_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeMultiThreadedLockableScore) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::routing::scoring::nativeMultiThreadedLockableScore) })
 }
 impl From<nativeMultiThreadedLockableScore> for crate::lightning::routing::scoring::WriteableScore {
        fn from(obj: nativeMultiThreadedLockableScore) -> Self {
 }
 impl From<nativeMultiThreadedLockableScore> for crate::lightning::routing::scoring::WriteableScore {
        fn from(obj: nativeMultiThreadedLockableScore) -> Self {
@@ -566,7 +682,7 @@ pub extern "C" fn MultiThreadedLockableScore_new(mut score: crate::lightning::ro
 
 
 use lightning::routing::scoring::MultiThreadedScoreLockRead as nativeMultiThreadedScoreLockReadImport;
 
 
 use lightning::routing::scoring::MultiThreadedScoreLockRead as nativeMultiThreadedScoreLockReadImport;
-pub(crate) type nativeMultiThreadedScoreLockRead = nativeMultiThreadedScoreLockReadImport<'static, crate::lightning::routing::scoring::Score>;
+pub(crate) type nativeMultiThreadedScoreLockRead = nativeMultiThreadedScoreLockReadImport<'static, crate::lightning::routing::scoring::Score>;
 
 /// A locked `MultiThreadedLockableScore`.
 #[must_use]
 
 /// A locked `MultiThreadedLockableScore`.
 #[must_use]
@@ -584,6 +700,12 @@ pub struct MultiThreadedScoreLockRead {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for MultiThreadedScoreLockRead {
+       type Target = nativeMultiThreadedScoreLockRead;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for MultiThreadedScoreLockRead { }
+unsafe impl core::marker::Sync for MultiThreadedScoreLockRead { }
 impl Drop for MultiThreadedScoreLockRead {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeMultiThreadedScoreLockRead>::is_null(self.inner) {
 impl Drop for MultiThreadedScoreLockRead {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeMultiThreadedScoreLockRead>::is_null(self.inner) {
@@ -614,10 +736,13 @@ impl MultiThreadedScoreLockRead {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 
 use lightning::routing::scoring::MultiThreadedScoreLockWrite as nativeMultiThreadedScoreLockWriteImport;
 }
 
 use lightning::routing::scoring::MultiThreadedScoreLockWrite as nativeMultiThreadedScoreLockWriteImport;
-pub(crate) type nativeMultiThreadedScoreLockWrite = nativeMultiThreadedScoreLockWriteImport<'static, crate::lightning::routing::scoring::Score>;
+pub(crate) type nativeMultiThreadedScoreLockWrite = nativeMultiThreadedScoreLockWriteImport<'static, crate::lightning::routing::scoring::Score>;
 
 /// A locked `MultiThreadedLockableScore`.
 #[must_use]
 
 /// A locked `MultiThreadedLockableScore`.
 #[must_use]
@@ -635,6 +760,12 @@ pub struct MultiThreadedScoreLockWrite {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for MultiThreadedScoreLockWrite {
+       type Target = nativeMultiThreadedScoreLockWrite;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for MultiThreadedScoreLockWrite { }
+unsafe impl core::marker::Sync for MultiThreadedScoreLockWrite { }
 impl Drop for MultiThreadedScoreLockWrite {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeMultiThreadedScoreLockWrite>::is_null(self.inner) {
 impl Drop for MultiThreadedScoreLockWrite {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeMultiThreadedScoreLockWrite>::is_null(self.inner) {
@@ -665,6 +796,9 @@ impl MultiThreadedScoreLockWrite {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 impl From<nativeMultiThreadedScoreLockRead> for crate::lightning::routing::scoring::ScoreLookUp {
        fn from(obj: nativeMultiThreadedScoreLockRead) -> Self {
 }
 impl From<nativeMultiThreadedScoreLockRead> for crate::lightning::routing::scoring::ScoreLookUp {
        fn from(obj: nativeMultiThreadedScoreLockRead) -> Self {
@@ -688,8 +822,8 @@ pub extern "C" fn MultiThreadedScoreLockRead_as_ScoreLookUp(this_arg: &MultiThre
 }
 
 #[must_use]
 }
 
 #[must_use]
-extern "C" fn MultiThreadedScoreLockRead_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
-       let mut ret = <nativeMultiThreadedScoreLockRead as lightning::routing::scoring::ScoreLookUp<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockRead) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref());
+extern "C" fn MultiThreadedScoreLockRead_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, candidate: &crate::lightning::routing::router::CandidateRouteHop, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
+       let mut ret = <nativeMultiThreadedScoreLockRead as lightning::routing::scoring::ScoreLookUp>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockRead) }, &candidate.to_native(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref());
        ret
 }
 
        ret
 }
 
@@ -700,7 +834,7 @@ pub extern "C" fn MultiThreadedScoreLockWrite_write(obj: &crate::lightning::rout
 }
 #[allow(unused)]
 pub(crate) extern "C" fn MultiThreadedScoreLockWrite_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn MultiThreadedScoreLockWrite_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeMultiThreadedScoreLockWrite) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::routing::scoring::nativeMultiThreadedScoreLockWrite) })
 }
 impl From<nativeMultiThreadedScoreLockWrite> for crate::lightning::routing::scoring::ScoreUpdate {
        fn from(obj: nativeMultiThreadedScoreLockWrite) -> Self {
 }
 impl From<nativeMultiThreadedScoreLockWrite> for crate::lightning::routing::scoring::ScoreUpdate {
        fn from(obj: nativeMultiThreadedScoreLockWrite) -> Self {
@@ -723,20 +857,24 @@ pub extern "C" fn MultiThreadedScoreLockWrite_as_ScoreUpdate(this_arg: &MultiThr
                payment_path_successful: MultiThreadedScoreLockWrite_ScoreUpdate_payment_path_successful,
                probe_failed: MultiThreadedScoreLockWrite_ScoreUpdate_probe_failed,
                probe_successful: MultiThreadedScoreLockWrite_ScoreUpdate_probe_successful,
                payment_path_successful: MultiThreadedScoreLockWrite_ScoreUpdate_payment_path_successful,
                probe_failed: MultiThreadedScoreLockWrite_ScoreUpdate_probe_failed,
                probe_successful: MultiThreadedScoreLockWrite_ScoreUpdate_probe_successful,
+               time_passed: MultiThreadedScoreLockWrite_ScoreUpdate_time_passed,
        }
 }
 
        }
 }
 
-extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) {
-       <nativeMultiThreadedScoreLockWrite as lightning::routing::scoring::ScoreUpdate<>>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref(), short_channel_id)
+extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: u64) {
+       <nativeMultiThreadedScoreLockWrite as lightning::routing::scoring::ScoreUpdate>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref(), short_channel_id, core::time::Duration::from_secs(duration_since_epoch))
+}
+extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut duration_since_epoch: u64) {
+       <nativeMultiThreadedScoreLockWrite as lightning::routing::scoring::ScoreUpdate>::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref(), core::time::Duration::from_secs(duration_since_epoch))
 }
 }
-extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) {
-       <nativeMultiThreadedScoreLockWrite as lightning::routing::scoring::ScoreUpdate<>>::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref())
+extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: u64) {
+       <nativeMultiThreadedScoreLockWrite as lightning::routing::scoring::ScoreUpdate>::probe_failed(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref(), short_channel_id, core::time::Duration::from_secs(duration_since_epoch))
 }
 }
-extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) {
-       <nativeMultiThreadedScoreLockWrite as lightning::routing::scoring::ScoreUpdate<>>::probe_failed(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref(), short_channel_id)
+extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut duration_since_epoch: u64) {
+       <nativeMultiThreadedScoreLockWrite as lightning::routing::scoring::ScoreUpdate>::probe_successful(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref(), core::time::Duration::from_secs(duration_since_epoch))
 }
 }
-extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) {
-       <nativeMultiThreadedScoreLockWrite as lightning::routing::scoring::ScoreUpdate<>>::probe_successful(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, path.get_native_ref())
+extern "C" fn MultiThreadedScoreLockWrite_ScoreUpdate_time_passed(this_arg: *mut c_void, mut duration_since_epoch: u64) {
+       <nativeMultiThreadedScoreLockWrite as lightning::routing::scoring::ScoreUpdate>::time_passed(unsafe { &mut *(this_arg as *mut nativeMultiThreadedScoreLockWrite) }, core::time::Duration::from_secs(duration_since_epoch))
 }
 
 
 }
 
 
@@ -759,6 +897,12 @@ pub struct ChannelUsage {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for ChannelUsage {
+       type Target = nativeChannelUsage;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for ChannelUsage { }
+unsafe impl core::marker::Sync for ChannelUsage { }
 impl Drop for ChannelUsage {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeChannelUsage>::is_null(self.inner) {
 impl Drop for ChannelUsage {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeChannelUsage>::is_null(self.inner) {
@@ -789,6 +933,9 @@ impl ChannelUsage {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// The amount to send through the channel, denominated in millisatoshis.
 #[no_mangle]
 }
 /// The amount to send through the channel, denominated in millisatoshis.
 #[no_mangle]
@@ -854,6 +1001,9 @@ pub(crate) extern "C" fn ChannelUsage_clone_void(this_ptr: *const c_void) -> *mu
 pub extern "C" fn ChannelUsage_clone(orig: &ChannelUsage) -> ChannelUsage {
        orig.clone()
 }
 pub extern "C" fn ChannelUsage_clone(orig: &ChannelUsage) -> ChannelUsage {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a ChannelUsage object
+pub extern "C" fn ChannelUsage_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::routing::scoring::ChannelUsage }).into()}
 
 use lightning::routing::scoring::FixedPenaltyScorer as nativeFixedPenaltyScorerImport;
 pub(crate) type nativeFixedPenaltyScorer = nativeFixedPenaltyScorerImport;
 
 use lightning::routing::scoring::FixedPenaltyScorer as nativeFixedPenaltyScorerImport;
 pub(crate) type nativeFixedPenaltyScorer = nativeFixedPenaltyScorerImport;
@@ -874,6 +1024,12 @@ pub struct FixedPenaltyScorer {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for FixedPenaltyScorer {
+       type Target = nativeFixedPenaltyScorer;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for FixedPenaltyScorer { }
+unsafe impl core::marker::Sync for FixedPenaltyScorer { }
 impl Drop for FixedPenaltyScorer {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeFixedPenaltyScorer>::is_null(self.inner) {
 impl Drop for FixedPenaltyScorer {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeFixedPenaltyScorer>::is_null(self.inner) {
@@ -904,6 +1060,9 @@ impl FixedPenaltyScorer {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 impl Clone for FixedPenaltyScorer {
        fn clone(&self) -> Self {
 }
 impl Clone for FixedPenaltyScorer {
        fn clone(&self) -> Self {
@@ -954,8 +1113,8 @@ pub extern "C" fn FixedPenaltyScorer_as_ScoreLookUp(this_arg: &FixedPenaltyScore
 }
 
 #[must_use]
 }
 
 #[must_use]
-extern "C" fn FixedPenaltyScorer_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
-       let mut ret = <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreLookUp<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref());
+extern "C" fn FixedPenaltyScorer_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, candidate: &crate::lightning::routing::router::CandidateRouteHop, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
+       let mut ret = <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreLookUp>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, &candidate.to_native(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref());
        ret
 }
 
        ret
 }
 
@@ -980,20 +1139,24 @@ pub extern "C" fn FixedPenaltyScorer_as_ScoreUpdate(this_arg: &FixedPenaltyScore
                payment_path_successful: FixedPenaltyScorer_ScoreUpdate_payment_path_successful,
                probe_failed: FixedPenaltyScorer_ScoreUpdate_probe_failed,
                probe_successful: FixedPenaltyScorer_ScoreUpdate_probe_successful,
                payment_path_successful: FixedPenaltyScorer_ScoreUpdate_payment_path_successful,
                probe_failed: FixedPenaltyScorer_ScoreUpdate_probe_failed,
                probe_successful: FixedPenaltyScorer_ScoreUpdate_probe_successful,
+               time_passed: FixedPenaltyScorer_ScoreUpdate_time_passed,
        }
 }
 
        }
 }
 
-extern "C" fn FixedPenaltyScorer_ScoreUpdate_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) {
-       <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreUpdate<>>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref(), short_channel_id)
+extern "C" fn FixedPenaltyScorer_ScoreUpdate_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: u64) {
+       <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreUpdate>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref(), short_channel_id, core::time::Duration::from_secs(duration_since_epoch))
+}
+extern "C" fn FixedPenaltyScorer_ScoreUpdate_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut duration_since_epoch: u64) {
+       <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreUpdate>::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref(), core::time::Duration::from_secs(duration_since_epoch))
 }
 }
-extern "C" fn FixedPenaltyScorer_ScoreUpdate_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) {
-       <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreUpdate<>>::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref())
+extern "C" fn FixedPenaltyScorer_ScoreUpdate_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: u64) {
+       <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreUpdate>::probe_failed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref(), short_channel_id, core::time::Duration::from_secs(duration_since_epoch))
 }
 }
-extern "C" fn FixedPenaltyScorer_ScoreUpdate_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) {
-       <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreUpdate<>>::probe_failed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref(), short_channel_id)
+extern "C" fn FixedPenaltyScorer_ScoreUpdate_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut duration_since_epoch: u64) {
+       <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreUpdate>::probe_successful(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref(), core::time::Duration::from_secs(duration_since_epoch))
 }
 }
-extern "C" fn FixedPenaltyScorer_ScoreUpdate_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) {
-       <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreUpdate<>>::probe_successful(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, path.get_native_ref())
+extern "C" fn FixedPenaltyScorer_ScoreUpdate_time_passed(this_arg: *mut c_void, mut duration_since_epoch: u64) {
+       <nativeFixedPenaltyScorer as lightning::routing::scoring::ScoreUpdate>::time_passed(unsafe { &mut *(this_arg as *mut nativeFixedPenaltyScorer) }, core::time::Duration::from_secs(duration_since_epoch))
 }
 
 #[no_mangle]
 }
 
 #[no_mangle]
@@ -1003,7 +1166,7 @@ pub extern "C" fn FixedPenaltyScorer_write(obj: &crate::lightning::routing::scor
 }
 #[allow(unused)]
 pub(crate) extern "C" fn FixedPenaltyScorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn FixedPenaltyScorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeFixedPenaltyScorer) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::routing::scoring::nativeFixedPenaltyScorer) })
 }
 #[no_mangle]
 /// Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
 }
 #[no_mangle]
 /// Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
@@ -1015,7 +1178,7 @@ pub extern "C" fn FixedPenaltyScorer_read(ser: crate::c_types::u8slice, arg: u64
 }
 
 use lightning::routing::scoring::ProbabilisticScorer as nativeProbabilisticScorerImport;
 }
 
 use lightning::routing::scoring::ProbabilisticScorer as nativeProbabilisticScorerImport;
-pub(crate) type nativeProbabilisticScorer = nativeProbabilisticScorerImport<&'static lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::util::logger::Logger>;
+pub(crate) type nativeProbabilisticScorer = nativeProbabilisticScorerImport<&'static lightning::routing::gossip::NetworkGraph<crate::lightning::util::logger::Logger>, crate::lightning::util::logger::Logger>;
 
 /// [`ScoreLookUp`] implementation using channel success probability distributions.
 ///
 
 /// [`ScoreLookUp`] implementation using channel success probability distributions.
 ///
@@ -1027,7 +1190,7 @@ pub(crate) type nativeProbabilisticScorer = nativeProbabilisticScorerImport<&'st
 /// These bounds are then used to determine a success probability using the formula from
 /// *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
 /// and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
 /// These bounds are then used to determine a success probability using the formula from
 /// *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
 /// and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
-///6762, 1070
+///
 /// This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
 /// [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
 /// milli-satoshis. The penalties, when added across all hops, have the property of being linear in
 /// This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
 /// [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
 /// milli-satoshis. The penalties, when added across all hops, have the property of being linear in
@@ -1042,11 +1205,6 @@ pub(crate) type nativeProbabilisticScorer = nativeProbabilisticScorerImport<&'st
 /// formula, but using the history of a channel rather than our latest estimates for the liquidity
 /// bounds.
 ///
 /// formula, but using the history of a channel rather than our latest estimates for the liquidity
 /// bounds.
 ///
-/// # Note
-///
-/// Mixing the `no-std` feature between serialization and deserialization results in undefined
-/// behavior.
-///
 /// [1]: https://arxiv.org/abs/2107.05322
 /// [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_multiplier_msat
 /// [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_amount_multiplier_msat
 /// [1]: https://arxiv.org/abs/2107.05322
 /// [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_multiplier_msat
 /// [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_amount_multiplier_msat
@@ -1068,6 +1226,12 @@ pub struct ProbabilisticScorer {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for ProbabilisticScorer {
+       type Target = nativeProbabilisticScorer;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for ProbabilisticScorer { }
+unsafe impl core::marker::Sync for ProbabilisticScorer { }
 impl Drop for ProbabilisticScorer {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeProbabilisticScorer>::is_null(self.inner) {
 impl Drop for ProbabilisticScorer {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeProbabilisticScorer>::is_null(self.inner) {
@@ -1098,6 +1262,9 @@ impl ProbabilisticScorer {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 
 use lightning::routing::scoring::ProbabilisticScoringFeeParameters as nativeProbabilisticScoringFeeParametersImport;
 }
 
 use lightning::routing::scoring::ProbabilisticScoringFeeParameters as nativeProbabilisticScoringFeeParametersImport;
@@ -1125,6 +1292,12 @@ pub struct ProbabilisticScoringFeeParameters {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for ProbabilisticScoringFeeParameters {
+       type Target = nativeProbabilisticScoringFeeParameters;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for ProbabilisticScoringFeeParameters { }
+unsafe impl core::marker::Sync for ProbabilisticScoringFeeParameters { }
 impl Drop for ProbabilisticScoringFeeParameters {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeProbabilisticScoringFeeParameters>::is_null(self.inner) {
 impl Drop for ProbabilisticScoringFeeParameters {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeProbabilisticScoringFeeParameters>::is_null(self.inner) {
@@ -1155,6 +1328,9 @@ impl ProbabilisticScoringFeeParameters {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// A fixed penalty in msats to apply to each channel.
 ///
 }
 /// A fixed penalty in msats to apply to each channel.
 ///
@@ -1583,6 +1759,12 @@ pub struct ProbabilisticScoringDecayParameters {
        pub is_owned: bool,
 }
 
        pub is_owned: bool,
 }
 
+impl core::ops::Deref for ProbabilisticScoringDecayParameters {
+       type Target = nativeProbabilisticScoringDecayParameters;
+       fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } }
+}
+unsafe impl core::marker::Send for ProbabilisticScoringDecayParameters { }
+unsafe impl core::marker::Sync for ProbabilisticScoringDecayParameters { }
 impl Drop for ProbabilisticScoringDecayParameters {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeProbabilisticScoringDecayParameters>::is_null(self.inner) {
 impl Drop for ProbabilisticScoringDecayParameters {
        fn drop(&mut self) {
                if self.is_owned && !<*mut nativeProbabilisticScoringDecayParameters>::is_null(self.inner) {
@@ -1613,6 +1795,9 @@ impl ProbabilisticScoringDecayParameters {
                self.inner = core::ptr::null_mut();
                ret
        }
                self.inner = core::ptr::null_mut();
                ret
        }
+       pub(crate) fn as_ref_to(&self) -> Self {
+               Self { inner: self.inner, is_owned: false }
+       }
 }
 /// If we aren't learning any new datapoints for a channel, the historical liquidity bounds
 /// tracking can simply live on with increasingly stale data. Instead, when a channel has not
 }
 /// If we aren't learning any new datapoints for a channel, the historical liquidity bounds
 /// tracking can simply live on with increasingly stale data. Instead, when a channel has not
@@ -1624,7 +1809,7 @@ impl ProbabilisticScoringDecayParameters {
 ///
 /// Default value: 14 days
 ///
 ///
 /// Default value: 14 days
 ///
-/// [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime::historical_estimated_channel_liquidity_probabilities
+/// [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities
 #[no_mangle]
 pub extern "C" fn ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(this_ptr: &ProbabilisticScoringDecayParameters) -> u64 {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().historical_no_updates_half_life;
 #[no_mangle]
 pub extern "C" fn ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(this_ptr: &ProbabilisticScoringDecayParameters) -> u64 {
        let mut inner_val = &mut this_ptr.get_native_mut_ref().historical_no_updates_half_life;
@@ -1640,7 +1825,7 @@ pub extern "C" fn ProbabilisticScoringDecayParameters_get_historical_no_updates_
 ///
 /// Default value: 14 days
 ///
 ///
 /// Default value: 14 days
 ///
-/// [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime::historical_estimated_channel_liquidity_probabilities
+/// [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities
 #[no_mangle]
 pub extern "C" fn ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(this_ptr: &mut ProbabilisticScoringDecayParameters, mut val: u64) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.historical_no_updates_half_life = core::time::Duration::from_secs(val);
 #[no_mangle]
 pub extern "C" fn ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(this_ptr: &mut ProbabilisticScoringDecayParameters, mut val: u64) {
        unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.historical_no_updates_half_life = core::time::Duration::from_secs(val);
@@ -1776,7 +1961,7 @@ pub extern "C" fn ProbabilisticScorer_estimated_channel_liquidity_range(this_arg
 /// in the top and bottom bucket, and roughly with similar (recent) frequency.
 ///
 /// Because the datapoints are decayed slowly over time, values will eventually return to
 /// in the top and bottom bucket, and roughly with similar (recent) frequency.
 ///
 /// Because the datapoints are decayed slowly over time, values will eventually return to
-/// `Some(([1; 32], [1; 32]))` and then to `None` once no datapoints remain.
+/// `Some(([0; 32], [0; 32]))` or `None` if no data remains for a channel.
 ///
 /// In order to fetch a single success probability from the buckets provided here, as used in
 /// the scoring model, see [`Self::historical_estimated_payment_success_probability`].
 ///
 /// In order to fetch a single success probability from the buckets provided here, as used in
 /// the scoring model, see [`Self::historical_estimated_payment_success_probability`].
@@ -1825,8 +2010,8 @@ pub extern "C" fn ProbabilisticScorer_as_ScoreLookUp(this_arg: &ProbabilisticSco
 }
 
 #[must_use]
 }
 
 #[must_use]
-extern "C" fn ProbabilisticScorer_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
-       let mut ret = <nativeProbabilisticScorer as lightning::routing::scoring::ScoreLookUp<>>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref());
+extern "C" fn ProbabilisticScorer_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, candidate: &crate::lightning::routing::router::CandidateRouteHop, mut usage: crate::lightning::routing::scoring::ChannelUsage, score_params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> u64 {
+       let mut ret = <nativeProbabilisticScorer as lightning::routing::scoring::ScoreLookUp>::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, &candidate.to_native(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref());
        ret
 }
 
        ret
 }
 
@@ -1851,20 +2036,24 @@ pub extern "C" fn ProbabilisticScorer_as_ScoreUpdate(this_arg: &ProbabilisticSco
                payment_path_successful: ProbabilisticScorer_ScoreUpdate_payment_path_successful,
                probe_failed: ProbabilisticScorer_ScoreUpdate_probe_failed,
                probe_successful: ProbabilisticScorer_ScoreUpdate_probe_successful,
                payment_path_successful: ProbabilisticScorer_ScoreUpdate_payment_path_successful,
                probe_failed: ProbabilisticScorer_ScoreUpdate_probe_failed,
                probe_successful: ProbabilisticScorer_ScoreUpdate_probe_successful,
+               time_passed: ProbabilisticScorer_ScoreUpdate_time_passed,
        }
 }
 
        }
 }
 
-extern "C" fn ProbabilisticScorer_ScoreUpdate_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) {
-       <nativeProbabilisticScorer as lightning::routing::scoring::ScoreUpdate<>>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref(), short_channel_id)
+extern "C" fn ProbabilisticScorer_ScoreUpdate_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: u64) {
+       <nativeProbabilisticScorer as lightning::routing::scoring::ScoreUpdate>::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref(), short_channel_id, core::time::Duration::from_secs(duration_since_epoch))
+}
+extern "C" fn ProbabilisticScorer_ScoreUpdate_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut duration_since_epoch: u64) {
+       <nativeProbabilisticScorer as lightning::routing::scoring::ScoreUpdate>::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref(), core::time::Duration::from_secs(duration_since_epoch))
 }
 }
-extern "C" fn ProbabilisticScorer_ScoreUpdate_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) {
-       <nativeProbabilisticScorer as lightning::routing::scoring::ScoreUpdate<>>::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref())
+extern "C" fn ProbabilisticScorer_ScoreUpdate_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: u64) {
+       <nativeProbabilisticScorer as lightning::routing::scoring::ScoreUpdate>::probe_failed(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref(), short_channel_id, core::time::Duration::from_secs(duration_since_epoch))
 }
 }
-extern "C" fn ProbabilisticScorer_ScoreUpdate_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64) {
-       <nativeProbabilisticScorer as lightning::routing::scoring::ScoreUpdate<>>::probe_failed(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref(), short_channel_id)
+extern "C" fn ProbabilisticScorer_ScoreUpdate_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut duration_since_epoch: u64) {
+       <nativeProbabilisticScorer as lightning::routing::scoring::ScoreUpdate>::probe_successful(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref(), core::time::Duration::from_secs(duration_since_epoch))
 }
 }
-extern "C" fn ProbabilisticScorer_ScoreUpdate_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path) {
-       <nativeProbabilisticScorer as lightning::routing::scoring::ScoreUpdate<>>::probe_successful(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, path.get_native_ref())
+extern "C" fn ProbabilisticScorer_ScoreUpdate_time_passed(this_arg: *mut c_void, mut duration_since_epoch: u64) {
+       <nativeProbabilisticScorer as lightning::routing::scoring::ScoreUpdate>::time_passed(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, core::time::Duration::from_secs(duration_since_epoch))
 }
 
 impl From<nativeProbabilisticScorer> for crate::lightning::routing::scoring::Score {
 }
 
 impl From<nativeProbabilisticScorer> for crate::lightning::routing::scoring::Score {
@@ -1896,24 +2085,13 @@ pub extern "C" fn ProbabilisticScorer_as_Score(this_arg: &ProbabilisticScorer) -
                        payment_path_successful: ProbabilisticScorer_ScoreUpdate_payment_path_successful,
                        probe_failed: ProbabilisticScorer_ScoreUpdate_probe_failed,
                        probe_successful: ProbabilisticScorer_ScoreUpdate_probe_successful,
                        payment_path_successful: ProbabilisticScorer_ScoreUpdate_payment_path_successful,
                        probe_failed: ProbabilisticScorer_ScoreUpdate_probe_failed,
                        probe_successful: ProbabilisticScorer_ScoreUpdate_probe_successful,
+                       time_passed: ProbabilisticScorer_ScoreUpdate_time_passed,
                },
                write: ProbabilisticScorer_write_void,
        }
 }
 
 
                },
                write: ProbabilisticScorer_write_void,
        }
 }
 
 
-mod approx {
-
-use alloc::str::FromStr;
-use alloc::string::String;
-use core::ffi::c_void;
-use core::convert::Infallible;
-use bitcoin::hashes::Hash;
-use crate::c_types::*;
-#[cfg(feature="no-std")]
-use alloc::{vec::Vec, boxed::Box};
-
-}
 mod bucketed_history {
 
 use alloc::str::FromStr;
 mod bucketed_history {
 
 use alloc::str::FromStr;
@@ -1933,7 +2111,7 @@ pub extern "C" fn ProbabilisticScorer_write(obj: &crate::lightning::routing::sco
 }
 #[allow(unused)]
 pub(crate) extern "C" fn ProbabilisticScorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
 }
 #[allow(unused)]
 pub(crate) extern "C" fn ProbabilisticScorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
-       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeProbabilisticScorer) })
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::routing::scoring::nativeProbabilisticScorer) })
 }
 #[no_mangle]
 /// Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
 }
 #[no_mangle]
 /// Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write