@@ -90,8 +90,9 @@ impl Handler {
90
90
self . inventory_repo
91
91
. get_missing_objects ( & mut inv)
92
92
. await
93
- . expect ( "Repo not to fail" ) ;
93
+ . expect ( "db won't fail" ) ;
94
94
if !inv. is_empty ( ) {
95
+ log:: debug!( "requesting {} missing objects..." , inv. len( ) ) ;
95
96
return Some ( NetworkMessage {
96
97
command : MessageCommand :: GetData ,
97
98
payload : MessagePayload :: GetData { inventory : inv } ,
@@ -110,7 +111,7 @@ impl Handler {
110
111
111
112
for obj in objects {
112
113
let hash_str = bs58:: encode ( & obj. hash ) . into_string ( ) ;
113
- self . requested_objects . retain ( |v| * v = = hash_str) ;
114
+ self . requested_objects . retain ( |v| * v ! = hash_str) ;
114
115
115
116
if self
116
117
. inventory_repo
@@ -119,7 +120,10 @@ impl Handler {
119
120
. unwrap ( )
120
121
. is_some ( )
121
122
{
122
- log:: debug!( "object {hash_str} is already in the inventory, skipping it" ) ;
123
+ log:: debug!(
124
+ "object {} is already in the inventory, skipping it" ,
125
+ hash_str
126
+ ) ;
123
127
continue ;
124
128
}
125
129
@@ -131,19 +135,14 @@ impl Handler {
131
135
let pow_check_res =
132
136
pow:: check_pow ( target, BigUint :: from_bytes_be ( & obj. nonce ) , obj. hash . clone ( ) ) ;
133
137
if pow_check_res. is_err ( ) {
134
- log:: warn!(
135
- "object with hash {:?} has invalid nonce! skipping it" ,
136
- bs58:: encode( obj. hash) . into_string( )
137
- ) ;
138
+ log:: warn!( "object {:?} has invalid nonce! skipping it" , hash_str) ;
138
139
continue ;
139
140
}
140
141
141
142
self . inventory_repo
142
143
. store_object ( obj. clone ( ) )
143
144
. await
144
- . expect ( "repo not to fail" ) ;
145
-
146
- self . offer_inv ( ) . await ;
145
+ . expect ( "db won't fail" ) ;
147
146
148
147
let handler_result = match & obj. kind {
149
148
ObjectKind :: Msg { encrypted : _ } => self . handle_msg_object ( obj. clone ( ) ) . await ,
@@ -164,6 +163,8 @@ impl Handler {
164
163
continue ;
165
164
}
166
165
}
166
+
167
+ self . offer_inv ( ) . await ;
167
168
}
168
169
169
170
async fn handle_pubkey_object ( & mut self , object : Object ) -> Result < ( ) , Box < dyn Error > > {
0 commit comments