@@ -5,6 +5,11 @@ import (
5
5
"context"
6
6
ejson "encoding/json"
7
7
"fmt"
8
+ "math/rand"
9
+ "net/http"
10
+ "sync"
11
+ "time"
12
+
8
13
"github.com/Qitmeer/qng/common/hash"
9
14
"github.com/Qitmeer/qng/common/roughtime"
10
15
"github.com/Qitmeer/qng/config"
@@ -23,10 +28,6 @@ import (
23
28
"github.com/Qitmeer/qng/rpc"
24
29
"github.com/Qitmeer/qng/services/mempool"
25
30
"github.com/Qitmeer/qng/services/mining"
26
- "math/rand"
27
- "net/http"
28
- "sync"
29
- "time"
30
31
)
31
32
32
33
const (
@@ -657,6 +658,8 @@ func (m *Miner) submitBlockHeader(header *types.BlockHeader, extraNonce uint64)
657
658
if ! IsEqualForMiner (& m .template .Block .Header , header ) {
658
659
return nil , fmt .Errorf ("You're overdue" )
659
660
}
661
+
662
+ start := time .Now ().UnixMilli ()
660
663
block , err := m .template .Block .Clone ()
661
664
if err != nil {
662
665
return nil , err
@@ -681,7 +684,9 @@ func (m *Miner) submitBlockHeader(header *types.BlockHeader, extraNonce uint64)
681
684
block .Header .Difficulty = header .Difficulty
682
685
block .Header .Timestamp = header .Timestamp
683
686
block .Header .Pow = header .Pow
684
- return m .submitBlock (types .NewBlock (block ))
687
+ res , err := m .submitBlock (types .NewBlock (block ))
688
+ m .StatsSubmit (time .Now ().UnixMilli ()- start , header .BlockHash ().String (), len (block .Transactions )- 1 )
689
+ return res , err
685
690
}
686
691
687
692
func (m * Miner ) CanMining () error {
0 commit comments