-
Notifications
You must be signed in to change notification settings - Fork 39
/
no_op_engine.go
85 lines (68 loc) · 2.65 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
85
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 (#627) - 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
}
func (e *ObscuroNoOpConsensusEngine) Finalize(_ consensus.ChainHeaderReader, _ *types.Header, _ *state.StateDB, _ []*types.Transaction, _ []*types.Header, _ []*types.Withdrawal) {
// TODO implement me
panic("implement me")
}
// Author is used to determine where to send the gas collected from the fees.
func (e *ObscuroNoOpConsensusEngine) Author(_ *types.Header) (common.Address, error) {
return PoolAddress, nil
}
func (e *ObscuroNoOpConsensusEngine) VerifyHeader(_ consensus.ChainHeaderReader, _ *types.Header) error {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) VerifyHeaders(_ consensus.ChainHeaderReader, _ []*types.Header) (chan<- struct{}, <-chan error) {
e.logger.Crit("noop")
return nil, nil
}
func (e *ObscuroNoOpConsensusEngine) VerifyUncles(_ consensus.ChainReader, _ *types.Block) error {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) Prepare(_ consensus.ChainHeaderReader, _ *types.Header) error {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) FinalizeAndAssemble(_ consensus.ChainHeaderReader, _ *types.Header, _ *state.StateDB, _ []*types.Transaction,
_ []*types.Header, _ []*types.Receipt, _ []*types.Withdrawal,
) (*types.Block, error) {
e.logger.Crit("noop")
return nil, nil //nolint:nilnil
}
func (e *ObscuroNoOpConsensusEngine) Seal(_ consensus.ChainHeaderReader, _ *types.Block, _ chan<- *types.Block, _ <-chan struct{}) error {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) SealHash(_ *types.Header) common.Hash {
e.logger.Crit("noop")
return common.Hash{}
}
func (e *ObscuroNoOpConsensusEngine) CalcDifficulty(_ consensus.ChainHeaderReader, _ uint64, _ *types.Header) *big.Int {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) APIs(_ consensus.ChainHeaderReader) []rpc.API {
e.logger.Crit("noop")
return nil
}
func (e *ObscuroNoOpConsensusEngine) Close() error {
e.logger.Crit("noop")
return nil
}