Skip to content

Commit c1ad66d

Browse files
committed
Miners are no longer certified idle in non-positive state
1 parent e694eb3 commit c1ad66d

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

node/calctag.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ func (n *Node) CalcTag(ch chan<- bool) {
4343
n.Pnc(utils.RecoverError(err))
4444
}
4545
}()
46-
47-
for {
48-
if n.GetRpcState() {
49-
n.getAllFileDirs()
50-
}
51-
time.Sleep(time.Minute)
52-
}
46+
n.getAllFileDirs()
5347
}
5448

5549
func (n *Node) getAllFileDirs() {
@@ -522,6 +516,8 @@ func (n *Node) reportFileTag(fid string, tags []string) (string, error) {
522516
}
523517
if int(tag.Index) > len(tags) {
524518
msg := fmt.Sprintf("[%s] invalid tag.Index: %d maxIndex: %d", fid, tag.Index, len(tags))
519+
os.Remove(v)
520+
n.Del("info", v)
525521
return "", errors.New(msg)
526522
}
527523
var dig = &pb.DigestInfo{

node/idlecert.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ func (n *Node) CertIdle(ch chan<- bool) {
3333
n.Pnc(utils.RecoverError(err))
3434
}
3535
}()
36-
for {
37-
err := n.attestationidle()
38-
n.SetCertifyingIdle(false)
39-
if err != nil {
40-
n.Space("err", err.Error())
41-
time.Sleep(time.Minute)
42-
}
43-
time.Sleep(chain.BlockInterval)
36+
if n.GetState() != chain.MINER_STATE_POSITIVE {
37+
return
38+
}
39+
err := n.attestationidle()
40+
n.SetCertifyingIdle(false)
41+
if err != nil {
42+
n.Space("err", err.Error())
4443
}
4544
}
4645

0 commit comments

Comments
 (0)