Skip to content

Commit

Permalink
add context and error return to non-SN view metric provider
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanschalm committed Oct 13, 2021
1 parent 4b0271f commit 30592e0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ func (fnb *FlowNodeBuilder) EnqueueNetworkInit(ctx context.Context) {
}
return head.Height, nil
},
HotstuffViewFun: func() (uint64, error) {
return 0, nil
},
HotstuffViewFun: nil, // set in next code block, depending on role
}

// only consensus roles will need to report hotstuff view
Expand All @@ -191,6 +189,11 @@ func (fnb *FlowNodeBuilder) EnqueueNetworkInit(ctx context.Context) {

return curView, nil
}
} else {
// non-consensus will not report any hotstuff view
pingProvider.HotstuffViewFun = func() (uint64, error) {
return 0, fmt.Errorf("non-consensus nodes do not report hotstuff view in ping")
}
}

libP2PNodeFactory, err := p2p.DefaultLibP2PNodeFactory(ctx,
Expand Down

0 comments on commit 30592e0

Please sign in to comment.