pub struct MonitorName(/* private fields */);Expand description
A struct representing a name for a channel monitor.
MonitorName is primarily used within the MonitorUpdatingPersister
in functions that store or retrieve channel monitor snapshots.
It provides a consistent way to generate a unique key for channel
monitors based on their funding outpoints.
While users of the Lightning Dev Kit library generally won’t need
to interact with MonitorName directly, it can be useful for:
- Custom persistence implementations
- Debugging or logging channel monitor operations
- Extending the functionality of the
MonitorUpdatingPersister
§Examples
use std::str::FromStr;
use bitcoin::Txid;
use lightning::util::persist::MonitorName;
use lightning::chain::transaction::OutPoint;
let outpoint = OutPoint {
txid: Txid::from_str("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef").unwrap(),
index: 1,
};
let monitor_name = MonitorName::from(outpoint);
assert_eq!(monitor_name.as_str(), "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1");
// Using MonitorName to generate a storage key
let storage_key = format!("channel_monitors/{}", monitor_name.as_str());Implementations§
Source§impl MonitorName
impl MonitorName
Trait Implementations§
Source§impl Debug for MonitorName
impl Debug for MonitorName
Source§impl From<OutPoint> for MonitorName
impl From<OutPoint> for MonitorName
Source§impl TryFrom<&MonitorName> for OutPoint
impl TryFrom<&MonitorName> for OutPoint
Auto Trait Implementations§
impl Freeze for MonitorName
impl RefUnwindSafe for MonitorName
impl Send for MonitorName
impl Sync for MonitorName
impl Unpin for MonitorName
impl UnwindSafe for MonitorName
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more