@@ -62,27 +62,20 @@ fn migrate_chain_state_v3_to_v4(old_chain_state_bytes: &[u8]) -> Vec<u8> {
62
62
let db_version: u32 = 4 ;
63
63
let db_version_bytes = db_version. to_le_bytes ( ) ;
64
64
65
- // This little trick makes sure that we don't run a migration on a v4 chain state that was
66
- // incorrectly tagged as v3 in the context of a development release, by checking if the bytes
67
- // match a pattern where the environment enum is stored at a certain position
68
- if old_chain_state_bytes[ 5 ..9 ] == [ 0x02 , 0x00 , 0x00 , 0x00 ] {
69
- // Extra fields in ChainState v4:
70
- let protocol_info = ProtocolInfo :: default ( ) ;
71
- let protocol_info_bytes = serialize ( & protocol_info) . unwrap ( ) ;
72
- let stakes = StakesTracker :: default ( ) ;
73
- let stakes_bytes = serialize ( & stakes) . unwrap ( ) ;
74
-
75
- [
76
- & db_version_bytes,
77
- & old_chain_state_bytes[ 4 ..5 ] ,
78
- & protocol_info_bytes,
79
- & old_chain_state_bytes[ 5 ..] ,
80
- & stakes_bytes,
81
- ]
82
- . concat ( )
83
- } else {
84
- [ & db_version_bytes, & old_chain_state_bytes[ 4 ..] ] . concat ( )
85
- }
65
+ // Extra fields in ChainState v4:
66
+ let protocol_info = ProtocolInfo :: default ( ) ;
67
+ let protocol_info_bytes = serialize ( & protocol_info) . unwrap ( ) ;
68
+ let stakes = StakesTracker :: default ( ) ;
69
+ let stakes_bytes = serialize ( & stakes) . unwrap ( ) ;
70
+
71
+ [
72
+ & db_version_bytes,
73
+ & old_chain_state_bytes[ 4 ..5 ] ,
74
+ & protocol_info_bytes,
75
+ & old_chain_state_bytes[ 5 ..] ,
76
+ & stakes_bytes,
77
+ ]
78
+ . concat ( )
86
79
}
87
80
88
81
fn migrate_chain_state ( mut bytes : Vec < u8 > ) -> Result < ChainState , failure:: Error > {
0 commit comments