File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -665,7 +665,7 @@ impl Tracker {
665
665
async fn deliver ( & self , leader : bool , tx : & Sender < CertifiedBlock < Validated > > ) -> Result < bool > {
666
666
if let Some ( cert) = self . votes . certificate ( ) {
667
667
if let Some ( block) = & self . block {
668
- let cb = CertifiedBlock :: new ( cert. clone ( ) , block. clone ( ) , leader) ;
668
+ let cb = CertifiedBlock :: v1 ( cert. clone ( ) , block. clone ( ) , leader) ;
669
669
tx. send ( cb) . await . map_err ( |_| EndOfPlay :: CertifierDown ) ?;
670
670
return Ok ( true ) ;
671
671
}
Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ mod tests {
252
252
}
253
253
}
254
254
let l = self . c . leader ( * i. round ( ) . num ( ) as usize ) == self . p ;
255
- CertifiedBlock :: new ( a. certificate ( ) . cloned ( ) . unwrap ( ) , b, l)
255
+ CertifiedBlock :: v1 ( a. certificate ( ) . cloned ( ) . unwrap ( ) , b, l)
256
256
}
257
257
}
258
258
Original file line number Diff line number Diff line change @@ -211,9 +211,12 @@ impl Committable for BlockInfo {
211
211
#[ cbor( map) ]
212
212
pub struct CertifiedBlock < S > {
213
213
#[ cbor( n( 0 ) ) ]
214
- data : Block ,
214
+ version : u8 ,
215
215
216
216
#[ cbor( n( 1 ) ) ]
217
+ data : Block ,
218
+
219
+ #[ cbor( n( 2 ) ) ]
217
220
cert : Certificate < BlockInfo > ,
218
221
219
222
#[ cbor( skip) ]
@@ -224,15 +227,20 @@ pub struct CertifiedBlock<S> {
224
227
}
225
228
226
229
impl < S > CertifiedBlock < S > {
227
- pub fn new ( cert : Certificate < BlockInfo > , data : Block , leader : bool ) -> Self {
230
+ pub fn v1 ( cert : Certificate < BlockInfo > , data : Block , leader : bool ) -> Self {
228
231
Self {
232
+ version : 1 ,
229
233
cert,
230
234
data,
231
235
leader,
232
236
_marker : PhantomData ,
233
237
}
234
238
}
235
239
240
+ pub fn version ( & self ) -> u8 {
241
+ self . version
242
+ }
243
+
236
244
pub fn committee ( & self ) -> CommitteeId {
237
245
self . cert . data ( ) . round ( ) . committee ( )
238
246
}
@@ -261,6 +269,7 @@ impl CertifiedBlock<Unchecked> {
261
269
. is_valid_with_threshold_par ( c, c. one_honest_threshold ( ) )
262
270
{
263
271
Some ( CertifiedBlock {
272
+ version : self . version ,
264
273
data : self . data ,
265
274
cert : self . cert ,
266
275
leader : self . leader ,
You can’t perform that action at this time.
0 commit comments