1414// You should have received a copy of the GNU Affero General Public License
1515// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
17- use std:: io:: Write ;
18- use std:: ops:: { self , Add , AddAssign , Deref , Sub , SubAssign } ;
17+ use std:: ops:: { Add , AddAssign , Deref , Sub , SubAssign } ;
1918
2019use ctypes:: BlockNumber ;
21- use kvdb:: PREFIX_LEN as DB_PREFIX_LEN ;
2220use primitives:: { H256 , H264 , U256 } ;
2321
24- use crate :: consensus:: epoch:: Transition as EpochTransition ;
2522use crate :: db:: Key ;
2623use crate :: types:: TransactionId ;
2724
@@ -36,8 +33,7 @@ enum ExtrasIndex {
3633 ParcelAddress = 2 ,
3734 /// Transaction address index
3835 TransactionAddress = 3 ,
39- /// Epoch transition data index.
40- EpochTransitions = 4 ,
36+ // (Reserved) = 4,
4137 // (Reserved) = 5,
4238}
4339
@@ -97,38 +93,6 @@ impl Key<TransactionAddresses> for H256 {
9793 }
9894}
9995
100- /// length of epoch keys.
101- const EPOCH_KEY_LEN : usize = DB_PREFIX_LEN + 16 ;
102-
103- /// epoch key prefix.
104- /// used to iterate over all epoch transitions in order from genesis.
105- pub const EPOCH_KEY_PREFIX : & [ u8 ; DB_PREFIX_LEN ] =
106- & [ ExtrasIndex :: EpochTransitions as u8 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
107-
108- pub struct EpochTransitionsKey ( [ u8 ; EPOCH_KEY_LEN ] ) ;
109-
110- impl ops:: Deref for EpochTransitionsKey {
111- type Target = [ u8 ] ;
112-
113- fn deref ( & self ) -> & [ u8 ] {
114- & self . 0 [ ..]
115- }
116- }
117-
118- impl Key < EpochTransitions > for u64 {
119- type Target = EpochTransitionsKey ;
120-
121- fn key ( & self ) -> Self :: Target {
122- let mut arr = [ 0u8 ; EPOCH_KEY_LEN ] ;
123- arr[ ..DB_PREFIX_LEN ] . copy_from_slice ( & EPOCH_KEY_PREFIX [ ..] ) ;
124-
125- write ! ( & mut arr[ DB_PREFIX_LEN ..] , "{:016x}" , self )
126- . expect ( "format arg is valid; no more than 16 chars will be written; qed" ) ;
127-
128- EpochTransitionsKey ( arr)
129- }
130- }
131-
13296/// Familial details concerning a block
13397#[ derive( Debug , Clone , RlpEncodable , RlpDecodable ) ]
13498pub struct BlockDetails {
@@ -161,13 +125,6 @@ pub struct TransactionAddresses {
161125 addresses : Vec < TransactionAddress > ,
162126}
163127
164- /// Candidate transitions to an epoch with specific number.
165- #[ derive( Clone , RlpEncodable , RlpDecodable ) ]
166- pub struct EpochTransitions {
167- pub number : u64 ,
168- pub candidates : Vec < EpochTransition > ,
169- }
170-
171128impl TransactionAddresses {
172129 pub fn new ( address : TransactionAddress ) -> Self {
173130 Self {
0 commit comments