none -> 0 for genesis
This commit is contained in:
parent
9fd98e9392
commit
a385333d3d
|
@ -301,7 +301,7 @@ impl Store for Storage {
|
|||
if block.hash() == new_best_hash { best_number + 1 }
|
||||
else { best_number }
|
||||
},
|
||||
None => 1,
|
||||
None => 0,
|
||||
};
|
||||
|
||||
let mut transaction = self.database.transaction();
|
||||
|
@ -369,6 +369,19 @@ mod tests {
|
|||
assert!(Storage::new(path.as_path()).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn insert_block() {
|
||||
let path = RandomTempPath::create_dir();
|
||||
let store = Storage::new(path.as_path()).unwrap();
|
||||
|
||||
let block: Block = test_data::block1();
|
||||
store.insert_block(&block).unwrap();
|
||||
|
||||
let loaded_block = store.block(BlockRef::Hash(block.hash())).unwrap();
|
||||
assert_eq!(loaded_block.hash(), block.hash());
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn insert_block() {
|
||||
let path = RandomTempPath::create_dir();
|
||||
|
|
Loading…
Reference in New Issue