|
1 | 1 | use std::{future::Future, ops::Deref, str::FromStr}; |
2 | 2 |
|
3 | | -use anyhow::{anyhow, Context}; |
| 3 | +use anyhow::Context; |
4 | 4 | use async_trait::async_trait; |
5 | 5 | use common::{ |
6 | 6 | api::{ |
@@ -63,45 +63,18 @@ pub trait LexeInnerPersister: Vfs + Persist<SignerType> { |
63 | 63 | index: PaymentIndex, |
64 | 64 | ) -> anyhow::Result<Option<Payment>>; |
65 | 65 |
|
66 | | - // --- Provided methods --- // |
67 | | - |
68 | 66 | async fn persist_manager<CM: Writeable + Send + Sync>( |
69 | 67 | &self, |
70 | 68 | channel_manager: &CM, |
71 | | - ) -> anyhow::Result<()> { |
72 | | - let file_id = VfsFileId::new( |
73 | | - constants::SINGLETON_DIRECTORY, |
74 | | - constants::CHANNEL_MANAGER_FILENAME, |
75 | | - ); |
76 | | - let file = self.encrypt_ldk_writeable(file_id, channel_manager); |
77 | | - self.persist_file(&file, constants::IMPORTANT_PERSIST_RETRIES) |
78 | | - .await |
79 | | - } |
| 69 | + ) -> anyhow::Result<()>; |
80 | 70 |
|
81 | | - async fn persist_monitor<PS: LexePersister>( |
| 71 | + async fn persist_channel_monitor<PS: LexePersister>( |
82 | 72 | &self, |
83 | 73 | chain_monitor: &LexeChainMonitorType<PS>, |
84 | 74 | funding_txo: &LxOutPoint, |
85 | | - ) -> anyhow::Result<()> { |
86 | | - let file = { |
87 | | - let locked_monitor = |
88 | | - chain_monitor.get_monitor((*funding_txo).into()).map_err( |
89 | | - |e| anyhow!("No monitor for this funding_txo: {e:?}"), |
90 | | - )?; |
91 | | - |
92 | | - // NOTE: The VFS filename uses the `ToString` impl of `LxOutPoint` |
93 | | - // rather than `lightning::chain::transaction::OutPoint` or |
94 | | - // `bitcoin::OutPoint`! `LxOutPoint`'s FromStr/Display impls are |
95 | | - // guaranteed to roundtrip, and will be stable across LDK versions. |
96 | | - let filename = funding_txo.to_string(); |
97 | | - let file_id = |
98 | | - VfsFileId::new(constants::CHANNEL_MONITORS_DIR, filename); |
99 | | - self.encrypt_ldk_writeable(file_id, &*locked_monitor) |
100 | | - }; |
101 | | - |
102 | | - self.persist_file(&file, constants::IMPORTANT_PERSIST_RETRIES) |
103 | | - .await |
104 | | - } |
| 75 | + ) -> anyhow::Result<()>; |
| 76 | + |
| 77 | + // --- Provided methods --- // |
105 | 78 |
|
106 | 79 | /// Reads all persisted events, along with their event IDs. |
107 | 80 | async fn read_events(&self) -> anyhow::Result<Vec<(EventId, Event)>> { |
|
0 commit comments