Skip to content

Commit 8496e53

Browse files
authored
fix(kyoto): Remove the Debug logs from public API
1 parent 436fd1d commit 8496e53

File tree

3 files changed

+6
-40
lines changed

3 files changed

+6
-40
lines changed

bdk-ffi/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bdk-ffi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ default = ["uniffi/cli"]
2121
bdk_wallet = { version = "2.1.0", features = ["all-keys", "keys-bip39", "rusqlite"] }
2222
bdk_esplora = { version = "0.22.1", default-features = false, features = ["std", "blocking", "blocking-https-rustls"] }
2323
bdk_electrum = { version = "0.23.1", default-features = false, features = ["use-rustls-ring"] }
24-
bdk_kyoto = { version = "0.13.1" }
24+
bdk_kyoto = { version = "0.14.0" }
2525

2626
uniffi = { version = "=0.29.4" }
2727
thiserror = "1.0.58"

bdk-ffi/src/kyoto.rs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use crate::types::Update;
3030
use crate::wallet::Wallet;
3131
use crate::FeeRate;
3232

33-
type LogLevel = bdk_kyoto::kyoto::LogLevel;
3433
type NodeState = bdk_kyoto::NodeState;
3534
type ScanType = bdk_kyoto::ScanType;
3635

@@ -53,7 +52,6 @@ pub struct CbfComponents {
5352
#[derive(Debug, uniffi::Object)]
5453
pub struct CbfClient {
5554
sender: Arc<Requester>,
56-
log_rx: Mutex<Receiver<String>>,
5755
info_rx: Mutex<Receiver<bdk_kyoto::Info>>,
5856
warning_rx: Mutex<UnboundedReceiver<bdk_kyoto::Warning>>,
5957
update_rx: Mutex<UpdateSubscriber>,
@@ -105,7 +103,6 @@ pub struct CbfBuilder {
105103
response_timeout: Duration,
106104
data_dir: Option<String>,
107105
scan_type: ScanType,
108-
log_level: LogLevel,
109106
dns_resolver: Option<Arc<IpAddress>>,
110107
socks5_proxy: Option<Socks5Proxy>,
111108
peers: Vec<Peer>,
@@ -122,7 +119,6 @@ impl CbfBuilder {
122119
response_timeout: MESSAGE_RESPONSE_TIMEOUT,
123120
data_dir: None,
124121
scan_type: ScanType::default(),
125-
log_level: LogLevel::default(),
126122
dns_resolver: None,
127123
socks5_proxy: None,
128124
peers: Vec::new(),
@@ -154,15 +150,6 @@ impl CbfBuilder {
154150
})
155151
}
156152

157-
/// Set the log level for the node. Production applications may want to omit `Debug` messages
158-
/// to avoid heap allocations.
159-
pub fn log_level(&self, log_level: LogLevel) -> Arc<Self> {
160-
Arc::new(CbfBuilder {
161-
log_level,
162-
..self.clone()
163-
})
164-
}
165-
166153
/// Bitcoin full-nodes to attempt a connection with.
167154
pub fn peers(&self, peers: Vec<Peer>) -> Arc<Self> {
168155
Arc::new(CbfBuilder {
@@ -220,7 +207,6 @@ impl CbfBuilder {
220207
.data_dir(path_buf)
221208
.handshake_timeout(self.handshake_timeout)
222209
.response_timeout(self.response_timeout)
223-
.log_level(self.log_level)
224210
.add_peers(trusted_peers);
225211

226212
if let Some(ip_addr) = self.dns_resolver.clone().map(|ip| ip.inner) {
@@ -235,7 +221,6 @@ impl CbfBuilder {
235221

236222
let BDKLightClient {
237223
requester,
238-
log_subscriber,
239224
info_subscriber,
240225
warning_subscriber,
241226
update_subscriber,
@@ -255,7 +240,6 @@ impl CbfBuilder {
255240

256241
let client = CbfClient {
257242
sender: Arc::new(requester),
258-
log_rx: Mutex::new(log_subscriber),
259243
info_rx: Mutex::new(info_subscriber),
260244
warning_rx: Mutex::new(warning_subscriber),
261245
update_rx: Mutex::new(update_subscriber),
@@ -271,12 +255,7 @@ impl CbfBuilder {
271255

272256
#[uniffi::export]
273257
impl CbfClient {
274-
/// Return the next available log message from a node. If none is returned, the node has stopped.
275-
pub async fn next_log(&self) -> Result<String, CbfError> {
276-
let mut log_rx = self.log_rx.lock().await;
277-
log_rx.recv().await.ok_or(CbfError::NodeStopped)
278-
}
279-
258+
/// Return the next available info message from a node. If none is returned, the node has stopped.
280259
pub async fn next_info(&self) -> Result<Info, CbfError> {
281260
let mut info_rx = self.info_rx.lock().await;
282261
info_rx
@@ -495,19 +474,6 @@ impl From<Warn> for Warning {
495474
}
496475
}
497476

498-
/// Select the category of messages for the node to emit.
499-
#[uniffi::remote(Enum)]
500-
pub enum LogLevel {
501-
/// Send string messages. These messages are intended for debugging or troubleshooting
502-
/// node operation.
503-
Debug,
504-
/// Send info and warning messages, but omit debug strings - including their memory allocations.
505-
/// Ideal for a production application that uses minimal logging.
506-
Info,
507-
/// Omit debug strings and info messages, including their memory allocations.
508-
Warning,
509-
}
510-
511477
/// The state of the node with respect to connected peers.
512478
#[uniffi::remote(Enum)]
513479
pub enum NodeState {

0 commit comments

Comments
 (0)