-
Notifications
You must be signed in to change notification settings - Fork 47
/
blockgenerator.go
38 lines (31 loc) · 1.04 KB
/
blockgenerator.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT License was not distributed with this
// file, you can obtain one at https://opensource.org/licenses/MIT.
//
// Copyright (c) DUSK NETWORK. All rights reserved.
package blockgenerator
import (
"github.com/dusk-network/dusk-blockchain/pkg/core/consensus"
"github.com/dusk-network/dusk-blockchain/pkg/core/consensus/blockgenerator/candidate"
)
type candidateGenerator = candidate.Generator
type blockGenerator struct {
candidateGenerator
}
// BlockGenerator ...
type BlockGenerator interface {
candidateGenerator
}
// New creates a new BlockGenerator.
func New(e *consensus.Emitter, f consensus.ExecuteTxsFunc) BlockGenerator {
return &blockGenerator{
candidateGenerator: candidate.New(e, f),
}
}
// Mock the block generator. If inert is true, no block will be generated (this
// simulates the score not reaching the threshold).
func Mock(e *consensus.Emitter, inert bool) BlockGenerator {
return &blockGenerator{
candidateGenerator: candidate.Mock(e),
}
}