@@ -133,7 +133,7 @@ mod tests {
 | 
				
			|||||||
        hasher.hash(&buf[..size]);
 | 
					        hasher.hash(&buf[..size]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //  golden needs to be updated if blob stuff changes....
 | 
					        //  golden needs to be updated if blob stuff changes....
 | 
				
			||||||
        let golden: Hash = "E2HZjSC6VgH4nmEiTbMDATTeBcFjwSYz7QYvU7doGNhD"
 | 
					        let golden: Hash = "37YzrTgiFRGQG1EoMZVecnGqxEK7UGxEQeBSdGMJcKqp"
 | 
				
			||||||
            .parse()
 | 
					            .parse()
 | 
				
			||||||
            .unwrap();
 | 
					            .unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -226,11 +226,13 @@ impl CodingGenerator {
 | 
				
			|||||||
                let index = data_blob.index();
 | 
					                let index = data_blob.index();
 | 
				
			||||||
                let slot = data_blob.slot();
 | 
					                let slot = data_blob.slot();
 | 
				
			||||||
                let id = data_blob.id();
 | 
					                let id = data_blob.id();
 | 
				
			||||||
 | 
					                let version = data_blob.version();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                let mut coding_blob = Blob::default();
 | 
					                let mut coding_blob = Blob::default();
 | 
				
			||||||
                coding_blob.set_index(index);
 | 
					                coding_blob.set_index(index);
 | 
				
			||||||
                coding_blob.set_slot(slot);
 | 
					                coding_blob.set_slot(slot);
 | 
				
			||||||
                coding_blob.set_id(&id);
 | 
					                coding_blob.set_id(&id);
 | 
				
			||||||
 | 
					                coding_blob.set_version(version);
 | 
				
			||||||
                coding_blob.set_size(max_data_size);
 | 
					                coding_blob.set_size(max_data_size);
 | 
				
			||||||
                coding_blob.set_coding();
 | 
					                coding_blob.set_coding();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -341,7 +341,8 @@ macro_rules! range {
 | 
				
			|||||||
const SIGNATURE_RANGE: std::ops::Range<usize> = range!(0, Signature);
 | 
					const SIGNATURE_RANGE: std::ops::Range<usize> = range!(0, Signature);
 | 
				
			||||||
const FORWARDED_RANGE: std::ops::Range<usize> = range!(SIGNATURE_RANGE.end, bool);
 | 
					const FORWARDED_RANGE: std::ops::Range<usize> = range!(SIGNATURE_RANGE.end, bool);
 | 
				
			||||||
const PARENT_RANGE: std::ops::Range<usize> = range!(FORWARDED_RANGE.end, u64);
 | 
					const PARENT_RANGE: std::ops::Range<usize> = range!(FORWARDED_RANGE.end, u64);
 | 
				
			||||||
const SLOT_RANGE: std::ops::Range<usize> = range!(PARENT_RANGE.end, u64);
 | 
					const VERSION_RANGE: std::ops::Range<usize> = range!(PARENT_RANGE.end, u64);
 | 
				
			||||||
 | 
					const SLOT_RANGE: std::ops::Range<usize> = range!(VERSION_RANGE.end, u64);
 | 
				
			||||||
const INDEX_RANGE: std::ops::Range<usize> = range!(SLOT_RANGE.end, u64);
 | 
					const INDEX_RANGE: std::ops::Range<usize> = range!(SLOT_RANGE.end, u64);
 | 
				
			||||||
const ID_RANGE: std::ops::Range<usize> = range!(INDEX_RANGE.end, Pubkey);
 | 
					const ID_RANGE: std::ops::Range<usize> = range!(INDEX_RANGE.end, Pubkey);
 | 
				
			||||||
const FLAGS_RANGE: std::ops::Range<usize> = range!(ID_RANGE.end, u32);
 | 
					const FLAGS_RANGE: std::ops::Range<usize> = range!(ID_RANGE.end, u32);
 | 
				
			||||||
@@ -391,6 +392,12 @@ impl Blob {
 | 
				
			|||||||
    pub fn set_parent(&mut self, ix: u64) {
 | 
					    pub fn set_parent(&mut self, ix: u64) {
 | 
				
			||||||
        LittleEndian::write_u64(&mut self.data[PARENT_RANGE], ix);
 | 
					        LittleEndian::write_u64(&mut self.data[PARENT_RANGE], ix);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    pub fn version(&self) -> u64 {
 | 
				
			||||||
 | 
					        LittleEndian::read_u64(&self.data[VERSION_RANGE])
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    pub fn set_version(&mut self, version: u64) {
 | 
				
			||||||
 | 
					        LittleEndian::write_u64(&mut self.data[VERSION_RANGE], version);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    pub fn slot(&self) -> u64 {
 | 
					    pub fn slot(&self) -> u64 {
 | 
				
			||||||
        LittleEndian::read_u64(&self.data[SLOT_RANGE])
 | 
					        LittleEndian::read_u64(&self.data[SLOT_RANGE])
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -862,4 +869,12 @@ mod tests {
 | 
				
			|||||||
        b.sign(&k);
 | 
					        b.sign(&k);
 | 
				
			||||||
        assert!(b.verify());
 | 
					        assert!(b.verify());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #[test]
 | 
				
			||||||
 | 
					    fn test_version() {
 | 
				
			||||||
 | 
					        let mut b = Blob::default();
 | 
				
			||||||
 | 
					        assert_eq!(b.version(), 0);
 | 
				
			||||||
 | 
					        b.set_version(1);
 | 
				
			||||||
 | 
					        assert_eq!(b.version(), 1);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user