File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed
light-client-lib/src/storage/db Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ mod browser;
1313#[ cfg( target_arch = "wasm32" ) ]
1414pub use browser:: { Batch , CursorDirection , Storage } ;
1515
16-
1716#[ cfg( not( target_arch = "wasm32" ) ) ]
1817use ckb_traits:: HeaderProvider ;
1918use ckb_types:: prelude:: Reader ;
@@ -181,7 +180,7 @@ impl Storage {
181180 self . get_pinned ( & key)
182181 . expect ( "db get last n headers should be ok" )
183182 . map ( |data| {
184- assert ! ( AsRef :: <[ u8 ] >:: as_ref( & data) . len( ) % 40 == 0 ) ;
183+ assert ! ( AsRef :: <[ u8 ] >:: as_ref( & data) . len( ) . is_multiple_of ( 40 ) ) ;
185184 let mut headers = Vec :: with_capacity ( & AsRef :: < [ u8 ] > :: as_ref ( & data) . len ( ) / 40 ) ;
186185 for part in AsRef :: < [ u8 ] > :: as_ref ( & data) . chunks ( 40 ) {
187186 let number = u64:: from_le_bytes ( part[ 0 ..8 ] . try_into ( ) . unwrap ( ) ) ;
Original file line number Diff line number Diff line change @@ -775,10 +775,7 @@ impl Batch {
775775 [ key, value] ,
776776 ) ?;
777777 } else {
778- tx. execute (
779- "UPDATE data SET value = ?2 WHERE key = ?1" ,
780- [ key, value] ,
781- ) ?;
778+ tx. execute ( "UPDATE data SET value = ?2 WHERE key = ?1" , [ key, value] ) ?;
782779 }
783780 tx. commit ( ) ?;
784781 }
You can’t perform that action at this time.
0 commit comments