mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
Don't mine when node is not connected (#1338)
This commit is contained in:
parent
d6fe9a3017
commit
97fddeff4b
@ -59,6 +59,12 @@ func (f *FlowContext) isSyncRateBelowMinimum() bool {
|
||||
// ShouldMine returns whether it's ok to use block template from this node
|
||||
// for mining purposes.
|
||||
func (f *FlowContext) ShouldMine() (bool, error) {
|
||||
peers := f.Peers()
|
||||
if len(peers) == 0 {
|
||||
log.Debugf("The node is not connected, so ShouldMine returns false")
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if f.isSyncRateBelowMinimum() {
|
||||
log.Debugf("The sync rate is below the minimum, so ShouldMine returns true")
|
||||
return true, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user