Skip to content

Commit

Permalink
default block time to 12s
Browse files Browse the repository at this point in the history
  • Loading branch information
p4u committed Nov 23, 2023
1 parent 89d1db7 commit 656988f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion vochain/vochaininfo/vochaininfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (
"go.vocdoni.io/dvote/vochain"
)

const (
defaultBlockTime = 12000
)

// VochainInfo stores some metrics and information regarding the Vochain Blockchain
// Avg1/10/60/360 are the block time average for 1 minute, 10 minutes, 1 hour and 6 hours
type VochainInfo struct {
Expand Down Expand Up @@ -51,7 +55,11 @@ func (vi *VochainInfo) Height() int64 {
func (vi *VochainInfo) BlockTimes() *[5]int32 {
vi.lock.RLock()
defer vi.lock.RUnlock()
return &[5]int32{vi.avg1, vi.avg10, vi.avg60, vi.avg360, vi.avg1440}
baseBlockTime := int32(defaultBlockTime)
if vi.avg1 != 0 {
baseBlockTime = vi.avg1
}
return &[5]int32{baseBlockTime, vi.avg10, vi.avg60, vi.avg360, vi.avg1440}
}

// HeightTime estimates the UTC time for a future height or returns the
Expand Down

0 comments on commit 656988f

Please sign in to comment.