@@ -14,6 +14,7 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr};
14
14
use std:: sync:: Arc ;
15
15
use std:: time:: { SystemTime , UNIX_EPOCH } ;
16
16
use tokio:: sync:: broadcast:: Sender ;
17
+ use tracing:: { debug, error} ;
17
18
18
19
#[ macro_export]
19
20
macro_rules! box_array {
@@ -150,6 +151,10 @@ pub async fn new_block(
150
151
. await
151
152
. map_err ( |e| NodeError :: AddMainChainBlock ( e. to_string ( ) ) ) ?
152
153
{
154
+ debug ! (
155
+ "Block with diverging data {:?}" ,
156
+ received_block. hash( ) . unwrap( )
157
+ ) ;
153
158
// diverging data
154
159
// get already existing block from the chain
155
160
let existing_block = context
@@ -178,16 +183,19 @@ pub async fn new_block(
178
183
}
179
184
180
185
// add block from the chain to the new data
181
- if new_data
186
+ if let Err ( e ) = new_data
182
187
. new_block (
183
188
existing_block,
184
189
& transactions,
185
190
& SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: new ( 0 , 0 , 0 , 0 ) ) , 0 ) ,
186
191
received_timestamp as usize ,
187
192
)
188
193
. await
189
- . is_err ( )
190
194
{
195
+ error ! (
196
+ "Error happened while adding new block to the new data: {:?}" ,
197
+ e
198
+ ) ;
191
199
return Ok ( false ) ;
192
200
} ;
193
201
}
@@ -300,8 +308,12 @@ mod dump_parse_tests {
300
308
// 5050,
301
309
// ));
302
310
311
+ // peers.insert(SocketAddr::new(
312
+ // std::net::IpAddr::V4(Ipv4Addr::new(192, 168, 1, 57)),
313
+ // 5050,
314
+ // ));
303
315
peers. insert ( SocketAddr :: new (
304
- std:: net:: IpAddr :: V4 ( Ipv4Addr :: new ( 192 , 168 , 1 , 57 ) ) ,
316
+ std:: net:: IpAddr :: V4 ( Ipv4Addr :: new ( 192 , 168 , 1 , 213 ) ) ,
305
317
5050 ,
306
318
) ) ;
307
319
0 commit comments