forked from ten-protocol/go-ten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathno_op_engine.go
84 lines (67 loc) · 2.72 KB
/
no_op_engine.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package evm
import (
"math/big"
gethlog "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
)
// PoolAddress - address of the pool where the gas will go
// TODO - this has to be reworked when the gas/fee work starts
var PoolAddress = common.HexToAddress("0x0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A")
// ObscuroNoOpConsensusEngine - implements the geth consensus.Engine, but doesn't do anything
// This is needed for running evm transactions
type ObscuroNoOpConsensusEngine struct {
logger gethlog.Logger
}
// Author is used to determine where to send the gas collected from the fees.
func (e *ObscuroNoOpConsensusEngine) Author(header *types.Header) (common.Address, error) {
return PoolAddress, nil
}
func (e *ObscuroNoOpConsensusEngine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) {
e.logger.Crit("noop")
return nil, nil
}
func (e *ObscuroNoOpConsensusEngine) VerifyUncles(chain consensus.ChainReader, block *types.Block) error {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header) {
e.logger.Crit("noop")
}
func (e *ObscuroNoOpConsensusEngine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction,
uncles []*types.Header, receipts []*types.Receipt,
) (*types.Block, error) {
e.logger.Crit("noop")
return nil, nil //nolint:nilnil
}
func (e *ObscuroNoOpConsensusEngine) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) SealHash(header *types.Header) common.Hash {
e.logger.Crit("noop")
return common.Hash{}
}
func (e *ObscuroNoOpConsensusEngine) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) APIs(chain consensus.ChainHeaderReader) []rpc.API {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) Close() error {
e.logger.Crit("noop")
return nil
}