write entries in blocktree now sets parent slot properly (#2800)

This commit is contained in:
carllin 2019-02-17 04:36:49 -08:00 committed by GitHub
parent 9fa8105ae8
commit 97a1e950ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -488,12 +488,19 @@ impl Blocktree {
let mut blobs = vec![];
let mut current_index = start_index;
let mut current_slot = start_slot;
let mut parent_slot = {
if current_slot == 0 {
current_slot
} else {
current_slot - 1
}
};
// Find all the entries for start_slot
for entry in entries {
if remaining_ticks_in_slot == 0 {
current_slot += 1;
current_index = 0;
parent_slot = current_slot - 1;
remaining_ticks_in_slot = ticks_per_slot;
}
@ -508,6 +515,7 @@ impl Blocktree {
b.set_index(current_index);
b.set_slot(current_slot);
b.set_parent(parent_slot);
blobs.push(b);
current_index += 1;