From c2f400ed65eb586bd911ad33997dff6fa53ba8d7 Mon Sep 17 00:00:00 2001 From: Georges Palauqui Date: Wed, 28 Aug 2024 14:13:23 +0200 Subject: [PATCH] debug stratum communication (wip) --- Cargo.lock | 2 +- src/main.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 29dc811..72a957f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1481,7 +1481,7 @@ dependencies = [ [[package]] name = "stratum-v1" version = "0.1.0" -source = "git+https://github.com/Foundation-Devices/foundation-rs.git?branch=stratum-v1#8f8e4601d6645d27e2a563087fadc056bb621d4f" +source = "git+https://github.com/Foundation-Devices/foundation-rs.git?branch=stratum-v1#87462a85a806cb3e647842ee96f31337b1e64afe" dependencies = [ "bitcoin_hashes", "defmt", diff --git a/src/main.rs b/src/main.rs index dc303b4..92f18bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ #![no_main] use core::str::FromStr; -use defmt::{debug, error, info}; +use defmt::{debug, error, info, trace}; use embassy_executor::Spawner; use embassy_net::{tcp::TcpSocket, Config, Ipv4Address, Stack, StackResources}; use embassy_sync::{blocking_mutex::raw::NoopRawMutex, mutex::Mutex, signal::Signal}; @@ -115,7 +115,6 @@ async fn main(spawner: Spawner) -> ! { mk_static!([u8; 1536], [0; 1536]), mk_static!([u8; 1536], [0; 1536]), ); - socket.set_timeout(Some(embassy_time::Duration::from_secs(3))); let remote_endpoint = (Ipv4Address::new(68, 235, 52, 36), 21496); // public-pool info!("connecting to pool..."); @@ -149,8 +148,10 @@ async fn main(spawner: Spawner) -> ! { subscribe_extranonce: None, info: None, }; - let mut client = client.lock().await; - client.send_configure(exts).await.unwrap(); + { + let mut client = client.lock().await; + client.send_configure(exts).await.unwrap(); + } loop { Timer::after(Duration::from_millis(5_000)).await; } @@ -167,6 +168,7 @@ async fn stratum_v1_rx_task( loop { // ticker.next().await; let mut client = client.lock().await; + trace!("Polling message..."); match client.poll_message().await { Ok(msg) => { if let Some(msg) = msg {