-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
erroring_node.go
147 lines (109 loc) · 4.5 KB
/
erroring_node.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
package client
import (
"context"
"math/big"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/utils"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
"github.com/pkg/errors"
)
var _ Node = (*erroringNode)(nil)
type erroringNode struct {
errMsg string
}
func (e *erroringNode) UnsubscribeAllExceptAliveLoop() {}
func (e *erroringNode) SubscribersCount() int32 {
return 0
}
func (e *erroringNode) ChainID() (chainID *big.Int) { return nil }
func (e *erroringNode) Start(ctx context.Context) error { return errors.New(e.errMsg) }
func (e *erroringNode) Close() error { return nil }
func (e *erroringNode) Verify(ctx context.Context, expectedChainID *big.Int) (err error) {
return errors.New(e.errMsg)
}
func (e *erroringNode) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error {
return errors.New(e.errMsg)
}
func (e *erroringNode) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error {
return errors.New(e.errMsg)
}
func (e *erroringNode) SendTransaction(ctx context.Context, tx *types.Transaction) error {
return errors.New(e.errMsg)
}
func (e *erroringNode) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) {
return 0, errors.New(e.errMsg)
}
func (e *erroringNode) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) {
return 0, errors.New(e.errMsg)
}
func (e *erroringNode) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) TransactionByHash(ctx context.Context, txHash common.Hash) (*types.Transaction, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) BlockNumber(ctx context.Context) (uint64, error) {
return 0, errors.New(e.errMsg)
}
func (e *erroringNode) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error) {
return 0, errors.New(e.errMsg)
}
func (e *erroringNode) SuggestGasPrice(ctx context.Context) (*big.Int, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) HeaderByNumber(_ context.Context, _ *big.Int) (*types.Header, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) HeaderByHash(_ context.Context, _ common.Hash) (*types.Header, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) EthSubscribe(ctx context.Context, channel chan<- *evmtypes.Head, args ...interface{}) (ethereum.Subscription, error) {
return nil, errors.New(e.errMsg)
}
func (e *erroringNode) String() string {
return "<erroring node>"
}
func (e *erroringNode) State() NodeState {
return NodeStateUnreachable
}
func (e *erroringNode) StateAndLatest() (NodeState, int64, *utils.Big) {
return NodeStateUnreachable, -1, nil
}
func (e *erroringNode) Order() int32 {
return 100
}
func (e *erroringNode) DeclareOutOfSync() {}
func (e *erroringNode) DeclareInSync() {}
func (e *erroringNode) DeclareUnreachable() {}
func (e *erroringNode) Name() string { return "" }
func (e *erroringNode) NodeStates() map[int32]string { return nil }