Skip to content

Commit 71001d2

Browse files
committed
move node info files to storage directory
1 parent 9c528d7 commit 71001d2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lightning/src/rgb_utils/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ use self::proxy::get_consignment;
4747

4848
/// Static blinding costant (will be removed in the future)
4949
pub const STATIC_BLINDING: u64 = 777;
50+
/// Name of the file containing the bitcoin network
51+
pub const BITCOIN_NETWORK_FNAME: &str = "bitcoin_network";
52+
/// Name of the file containing the electrum URL
53+
pub const ELECTRUM_URL_FNAME: &str = "electrum_url";
54+
/// Name of the file containing the wallet fingerprint
55+
pub const WALLET_FINGERPRINT_FNAME: &str = "wallet_fingerprint";
5056

5157
/// RGB channel info
5258
#[derive(Debug, Clone, Deserialize, Serialize)]
@@ -86,18 +92,18 @@ pub struct TransferInfo {
8692
}
8793

8894
fn _get_resolver(ldk_data_dir: &Path) -> BlockchainResolver {
89-
let electrum_url = fs::read_to_string(ldk_data_dir.join("electrum_url")).expect("able to read");
95+
let electrum_url = fs::read_to_string(ldk_data_dir.parent().unwrap().join(ELECTRUM_URL_FNAME)).expect("able to read");
9096
BlockchainResolver::with(&electrum_url).expect("able to get resolver")
9197
}
9298

9399
fn _get_rgb_wallet_dir(ldk_data_dir: &Path) -> PathBuf {
94-
let wallet_fingerprint = fs::read_to_string(ldk_data_dir.join("wallet_fingerprint")).expect("able to read");
100+
let wallet_fingerprint = fs::read_to_string(ldk_data_dir.parent().unwrap().join(WALLET_FINGERPRINT_FNAME)).expect("able to read");
95101
ldk_data_dir.parent().unwrap().join(wallet_fingerprint)
96102
}
97103

98104
/// Get an instance of the RGB runtime
99105
pub fn get_rgb_runtime(ldk_data_dir: &Path) -> RgbRuntime {
100-
let bitcoin_network_str = fs::read_to_string(ldk_data_dir.join("bitcoin_network")).expect("able to read");
106+
let bitcoin_network_str = fs::read_to_string(ldk_data_dir.parent().unwrap().join(BITCOIN_NETWORK_FNAME)).expect("able to read");
101107
let bitcoin_network = BitcoinNetwork::from_str(&bitcoin_network_str).unwrap();
102108
load_rgb_runtime(_get_rgb_wallet_dir(ldk_data_dir), bitcoin_network).expect("RGB runtime should be available")
103109
}

0 commit comments

Comments
 (0)