@@ -9,7 +9,7 @@ use std::io::{ErrorKind, Read, Seek, Write};
9
9
use std:: path:: PathBuf ;
10
10
use ton_block:: { InMsg , OutMsg , AccountStatus , ExtOutMessageHeader , MsgEnvelope } ;
11
11
use ton_block:: { HashmapAugType , BlkPrevInfo , Deserializable , ShardIdent } ;
12
- use ton_types:: { UInt256 , deserialize_tree_of_cells, BagOfCells } ;
12
+ use ton_types:: { UInt256 , deserialize_tree_of_cells} ;
13
13
14
14
#[ cfg( test) ]
15
15
#[ path = "../../../tonos-se-tests/unit/test_block_finality.rs" ]
@@ -101,9 +101,7 @@ debug!("FINBLK {:?}", hashes);
101
101
lt : info. end_lt ( ) ,
102
102
hash : sb. block_hash . clone ( ) ,
103
103
} ;
104
- let mut shard = vec ! [ ] ;
105
- BagOfCells :: with_root ( & sb. shard_state . serialize ( ) ?)
106
- . write_to ( & mut shard, false ) ?;
104
+ let shard = sb. shard_state . write_to_bytes ( ) ?;
107
105
// save shard state
108
106
self . shard_state_storage . save_serialized_shardstate_ex (
109
107
& ShardStateUnsplit :: default ( ) , Some ( shard) , & sb. block . block ( ) . read_state_update ( ) ?. new_hash ,
@@ -718,10 +716,7 @@ impl ShardBlock {
718
716
719
717
// Test-lite-client requires hash od unsigned block
720
718
// TODO will to think, how to do better
721
- let mut block_data = vec ! [ ] ;
722
- let cell = sblock. block ( ) . serialize ( ) . unwrap ( ) ; // TODO process result
723
- let bag = BagOfCells :: with_root ( & cell) ;
724
- bag. write_to ( & mut block_data, false ) . unwrap ( ) ; // TODO process result
719
+ let block_data = sblock. block ( ) . write_to_bytes ( ) . unwrap ( ) ; // TODO process result
725
720
726
721
let mut hasher = Sha256 :: new ( ) ;
727
722
hasher. input ( block_data. as_slice ( ) ) ;
@@ -742,12 +737,11 @@ impl ShardBlock {
742
737
let mut buf = Vec :: new ( ) ;
743
738
buf. extend_from_slice ( & self . seq_no . to_le_bytes ( ) ) ;
744
739
buf. extend_from_slice ( & ( self . serialized_block . len ( ) as u32 ) . to_le_bytes ( ) ) ;
745
- buf. append ( & mut self . serialized_block . clone ( ) ) ;
746
- buf. append ( & mut self . block_hash . as_slice ( ) . to_vec ( ) ) ;
747
- buf. append ( & mut self . file_hash . as_slice ( ) . to_vec ( ) ) ;
740
+ buf. extend_from_slice ( self . serialized_block . as_slice ( ) ) ;
741
+ buf. extend_from_slice ( self . block_hash . as_slice ( ) ) ;
742
+ buf. extend_from_slice ( self . file_hash . as_slice ( ) ) ;
748
743
749
- BagOfCells :: with_root ( & self . shard_state . serialize ( ) ?)
750
- . write_to ( & mut buf, false ) ?;
744
+ buf. append ( & mut self . shard_state . write_to_bytes ( ) ?) ;
751
745
752
746
let mut block_buf = Vec :: new ( ) ;
753
747
self . block . write_to ( & mut block_buf) ?;
0 commit comments