diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index e5d0386615b..469e9501204 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -57,7 +57,6 @@ use crate::events::bump_transaction::{AnchorDescriptor, BumpTransactionEvent}; use crate::prelude::*; use core::{cmp, mem}; -use std::path::PathBuf; use crate::io::{self, Error}; use core::ops::Deref; use crate::sync::{Mutex, LockTestExt}; diff --git a/lightning/src/color_ext/database.rs b/lightning/src/color_ext/database.rs index e9adb6ac9b7..a7334b22d37 100644 --- a/lightning/src/color_ext/database.rs +++ b/lightning/src/color_ext/database.rs @@ -83,7 +83,7 @@ impl PaymentHashKey { } #[derive(Clone, Debug, Default)] -struct RgbPaymentCache { +pub(crate) struct RgbPaymentCache { by_proxy_id: HashMap, by_payment_hash_key: HashMap, by_payment_hash: HashMap, @@ -151,7 +151,7 @@ impl RgbPaymentCache { } #[derive(Clone, Debug, Default)] -struct TransferInfoCache { +pub(crate) struct TransferInfoCache { by_txid: HashMap, } @@ -192,7 +192,7 @@ impl RgbInfoKey { } #[derive(Clone, Debug, Default)] -struct RgbInfoCache { +pub(crate) struct RgbInfoCache { by_rgb_info_key: HashMap, } @@ -232,7 +232,7 @@ impl Write for ConsignmentBinaryData { pub struct ConsignmentHandle(usize); #[derive(Clone, Debug, Default)] -struct ConsignmentCache { +pub(crate) struct ConsignmentCache { by_channel_id: HashMap, by_funding_txid: HashMap, data_store: HashMap, diff --git a/lightning/src/color_ext/mod.rs b/lightning/src/color_ext/mod.rs index cfa7bbd450e..0c9a2968653 100644 --- a/lightning/src/color_ext/mod.rs +++ b/lightning/src/color_ext/mod.rs @@ -39,6 +39,7 @@ use std::sync::{Arc, Mutex}; use crate::rgb_utils::{RgbInfo, RgbPaymentInfo, TransferInfo}; +#[allow(missing_docs)] pub mod database; /// Static blinding costant (will be removed in the future) @@ -252,7 +253,6 @@ impl ColorSourceImpl { ); } - // 获取或插入 RgbPaymentInfo let rgb_payment_info = self .database .rgb_payment() @@ -639,7 +639,7 @@ impl ColorSourceImpl { } /// Update pending RGB channel amount - pub(crate) fn update_rgb_channel_amount_pending( + pub fn update_rgb_channel_amount_pending( &self, channel_id: &ChannelId, rgb_offered_htlc: u64, rgb_received_htlc: u64, ) { self.update_rgb_channel_amount_impl(&channel_id, rgb_offered_htlc, rgb_received_htlc, true) @@ -701,7 +701,7 @@ impl ColorSourceImpl { pub fn update_rgb_channel_amount(&self, payment_hash: &PaymentHash, receiver: bool) { let payment = self.database.rgb_payment().lock().unwrap().get_by_payment_hash_key( &PaymentHashKey::new(payment_hash.clone(), PaymentDirection::from(receiver)), - ); + ).cloned(); if payment.is_none() { return; } @@ -720,4 +720,8 @@ impl ColorSourceImpl { if receiver { (0, rgb_payment_info.amount) } else { (rgb_payment_info.amount, 0) }; self.update_rgb_channel_amount_impl(&channel_id, offered, received, false); } + + pub fn get_transfer_info(&self, txid: &Txid) -> Option { + self.database.transfer_info().lock().unwrap().get_by_txid(txid).cloned() + } } diff --git a/lightning/src/lib.rs b/lightning/src/lib.rs index da1bc7a3a88..be35b038c56 100644 --- a/lightning/src/lib.rs +++ b/lightning/src/lib.rs @@ -192,4 +192,5 @@ mod sync; pub mod rgb_utils; /// RGB specific extensions to the lightning library +#[allow(missing_docs)] pub mod color_ext; diff --git a/lightning/src/rgb_utils/mod.rs b/lightning/src/rgb_utils/mod.rs index 03f56ba852a..8c1aa1c78a6 100644 --- a/lightning/src/rgb_utils/mod.rs +++ b/lightning/src/rgb_utils/mod.rs @@ -33,7 +33,6 @@ use std::collections::HashMap; use std::fs; use std::path::{Path, PathBuf}; use std::str::FromStr; -/* /// Static blinding costant (will be removed in the future) pub const STATIC_BLINDING: u64 = 777; /// Name of the file containing the bitcoin network @@ -44,9 +43,8 @@ pub const INDEXER_URL_FNAME: &str = "indexer_url"; pub const WALLET_FINGERPRINT_FNAME: &str = "wallet_fingerprint"; /// Name of the file containing the wallet account xPub pub const WALLET_ACCOUNT_XPUB_FNAME: &str = "wallet_account_xpub"; -const INBOUND_EXT: &str = "inbound"; -const OUTBOUND_EXT: &str = "outbound"; - */ +// const INBOUND_EXT: &str = "inbound"; +// const OUTBOUND_EXT: &str = "outbound"; /// RGB channel info #[derive(Debug, Clone, Deserialize, Serialize)] pub struct RgbInfo {