@@ -37,26 +37,26 @@ import (
3737 "github.com/ethereum/go-ethereum/rpc"
3838)
3939
40- // EthApiBackend implements ethapi.Backend for full nodes
41- type EthApiBackend struct {
40+ // EthAPIBackend implements ethapi.Backend for full nodes
41+ type EthAPIBackend struct {
4242 eth * Ethereum
4343 gpo * gasprice.Oracle
4444}
4545
46- func (b * EthApiBackend ) ChainConfig () * params.ChainConfig {
46+ func (b * EthAPIBackend ) ChainConfig () * params.ChainConfig {
4747 return b .eth .chainConfig
4848}
4949
50- func (b * EthApiBackend ) CurrentBlock () * types.Block {
50+ func (b * EthAPIBackend ) CurrentBlock () * types.Block {
5151 return b .eth .blockchain .CurrentBlock ()
5252}
5353
54- func (b * EthApiBackend ) SetHead (number uint64 ) {
54+ func (b * EthAPIBackend ) SetHead (number uint64 ) {
5555 b .eth .protocolManager .downloader .Cancel ()
5656 b .eth .blockchain .SetHead (number )
5757}
5858
59- func (b * EthApiBackend ) HeaderByNumber (ctx context.Context , blockNr rpc.BlockNumber ) (* types.Header , error ) {
59+ func (b * EthAPIBackend ) HeaderByNumber (ctx context.Context , blockNr rpc.BlockNumber ) (* types.Header , error ) {
6060 // Pending block is only known by the miner
6161 if blockNr == rpc .PendingBlockNumber {
6262 block := b .eth .miner .PendingBlock ()
@@ -69,7 +69,7 @@ func (b *EthApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNum
6969 return b .eth .blockchain .GetHeaderByNumber (uint64 (blockNr )), nil
7070}
7171
72- func (b * EthApiBackend ) BlockByNumber (ctx context.Context , blockNr rpc.BlockNumber ) (* types.Block , error ) {
72+ func (b * EthAPIBackend ) BlockByNumber (ctx context.Context , blockNr rpc.BlockNumber ) (* types.Block , error ) {
7373 // Pending block is only known by the miner
7474 if blockNr == rpc .PendingBlockNumber {
7575 block := b .eth .miner .PendingBlock ()
@@ -82,7 +82,7 @@ func (b *EthApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumb
8282 return b .eth .blockchain .GetBlockByNumber (uint64 (blockNr )), nil
8383}
8484
85- func (b * EthApiBackend ) StateAndHeaderByNumber (ctx context.Context , blockNr rpc.BlockNumber ) (* state.StateDB , * types.Header , error ) {
85+ func (b * EthAPIBackend ) StateAndHeaderByNumber (ctx context.Context , blockNr rpc.BlockNumber ) (* state.StateDB , * types.Header , error ) {
8686 // Pending state is only known by the miner
8787 if blockNr == rpc .PendingBlockNumber {
8888 block , state := b .eth .miner .Pending ()
@@ -97,18 +97,18 @@ func (b *EthApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.
9797 return stateDb , header , err
9898}
9999
100- func (b * EthApiBackend ) GetBlock (ctx context.Context , hash common.Hash ) (* types.Block , error ) {
100+ func (b * EthAPIBackend ) GetBlock (ctx context.Context , hash common.Hash ) (* types.Block , error ) {
101101 return b .eth .blockchain .GetBlockByHash (hash ), nil
102102}
103103
104- func (b * EthApiBackend ) GetReceipts (ctx context.Context , hash common.Hash ) (types.Receipts , error ) {
104+ func (b * EthAPIBackend ) GetReceipts (ctx context.Context , hash common.Hash ) (types.Receipts , error ) {
105105 if number := rawdb .ReadHeaderNumber (b .eth .chainDb , hash ); number != nil {
106106 return rawdb .ReadReceipts (b .eth .chainDb , hash , * number ), nil
107107 }
108108 return nil , nil
109109}
110110
111- func (b * EthApiBackend ) GetLogs (ctx context.Context , hash common.Hash ) ([][]* types.Log , error ) {
111+ func (b * EthAPIBackend ) GetLogs (ctx context.Context , hash common.Hash ) ([][]* types.Log , error ) {
112112 number := rawdb .ReadHeaderNumber (b .eth .chainDb , hash )
113113 if number == nil {
114114 return nil , nil
@@ -124,43 +124,43 @@ func (b *EthApiBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*typ
124124 return logs , nil
125125}
126126
127- func (b * EthApiBackend ) GetTd (blockHash common.Hash ) * big.Int {
127+ func (b * EthAPIBackend ) GetTd (blockHash common.Hash ) * big.Int {
128128 return b .eth .blockchain .GetTdByHash (blockHash )
129129}
130130
131- func (b * EthApiBackend ) GetEVM (ctx context.Context , msg core.Message , state * state.StateDB , header * types.Header , vmCfg vm.Config ) (* vm.EVM , func () error , error ) {
131+ func (b * EthAPIBackend ) GetEVM (ctx context.Context , msg core.Message , state * state.StateDB , header * types.Header , vmCfg vm.Config ) (* vm.EVM , func () error , error ) {
132132 state .SetBalance (msg .From (), math .MaxBig256 )
133133 vmError := func () error { return nil }
134134
135135 context := core .NewEVMContext (msg , header , b .eth .BlockChain (), nil )
136136 return vm .NewEVM (context , state , b .eth .chainConfig , vmCfg ), vmError , nil
137137}
138138
139- func (b * EthApiBackend ) SubscribeRemovedLogsEvent (ch chan <- core.RemovedLogsEvent ) event.Subscription {
139+ func (b * EthAPIBackend ) SubscribeRemovedLogsEvent (ch chan <- core.RemovedLogsEvent ) event.Subscription {
140140 return b .eth .BlockChain ().SubscribeRemovedLogsEvent (ch )
141141}
142142
143- func (b * EthApiBackend ) SubscribeChainEvent (ch chan <- core.ChainEvent ) event.Subscription {
143+ func (b * EthAPIBackend ) SubscribeChainEvent (ch chan <- core.ChainEvent ) event.Subscription {
144144 return b .eth .BlockChain ().SubscribeChainEvent (ch )
145145}
146146
147- func (b * EthApiBackend ) SubscribeChainHeadEvent (ch chan <- core.ChainHeadEvent ) event.Subscription {
147+ func (b * EthAPIBackend ) SubscribeChainHeadEvent (ch chan <- core.ChainHeadEvent ) event.Subscription {
148148 return b .eth .BlockChain ().SubscribeChainHeadEvent (ch )
149149}
150150
151- func (b * EthApiBackend ) SubscribeChainSideEvent (ch chan <- core.ChainSideEvent ) event.Subscription {
151+ func (b * EthAPIBackend ) SubscribeChainSideEvent (ch chan <- core.ChainSideEvent ) event.Subscription {
152152 return b .eth .BlockChain ().SubscribeChainSideEvent (ch )
153153}
154154
155- func (b * EthApiBackend ) SubscribeLogsEvent (ch chan <- []* types.Log ) event.Subscription {
155+ func (b * EthAPIBackend ) SubscribeLogsEvent (ch chan <- []* types.Log ) event.Subscription {
156156 return b .eth .BlockChain ().SubscribeLogsEvent (ch )
157157}
158158
159- func (b * EthApiBackend ) SendTx (ctx context.Context , signedTx * types.Transaction ) error {
159+ func (b * EthAPIBackend ) SendTx (ctx context.Context , signedTx * types.Transaction ) error {
160160 return b .eth .txPool .AddLocal (signedTx )
161161}
162162
163- func (b * EthApiBackend ) GetPoolTransactions () (types.Transactions , error ) {
163+ func (b * EthAPIBackend ) GetPoolTransactions () (types.Transactions , error ) {
164164 pending , err := b .eth .txPool .Pending ()
165165 if err != nil {
166166 return nil , err
@@ -172,56 +172,56 @@ func (b *EthApiBackend) GetPoolTransactions() (types.Transactions, error) {
172172 return txs , nil
173173}
174174
175- func (b * EthApiBackend ) GetPoolTransaction (hash common.Hash ) * types.Transaction {
175+ func (b * EthAPIBackend ) GetPoolTransaction (hash common.Hash ) * types.Transaction {
176176 return b .eth .txPool .Get (hash )
177177}
178178
179- func (b * EthApiBackend ) GetPoolNonce (ctx context.Context , addr common.Address ) (uint64 , error ) {
179+ func (b * EthAPIBackend ) GetPoolNonce (ctx context.Context , addr common.Address ) (uint64 , error ) {
180180 return b .eth .txPool .State ().GetNonce (addr ), nil
181181}
182182
183- func (b * EthApiBackend ) Stats () (pending int , queued int ) {
183+ func (b * EthAPIBackend ) Stats () (pending int , queued int ) {
184184 return b .eth .txPool .Stats ()
185185}
186186
187- func (b * EthApiBackend ) TxPoolContent () (map [common.Address ]types.Transactions , map [common.Address ]types.Transactions ) {
187+ func (b * EthAPIBackend ) TxPoolContent () (map [common.Address ]types.Transactions , map [common.Address ]types.Transactions ) {
188188 return b .eth .TxPool ().Content ()
189189}
190190
191- func (b * EthApiBackend ) SubscribeTxPreEvent (ch chan <- core.TxPreEvent ) event.Subscription {
191+ func (b * EthAPIBackend ) SubscribeTxPreEvent (ch chan <- core.TxPreEvent ) event.Subscription {
192192 return b .eth .TxPool ().SubscribeTxPreEvent (ch )
193193}
194194
195- func (b * EthApiBackend ) Downloader () * downloader.Downloader {
195+ func (b * EthAPIBackend ) Downloader () * downloader.Downloader {
196196 return b .eth .Downloader ()
197197}
198198
199- func (b * EthApiBackend ) ProtocolVersion () int {
199+ func (b * EthAPIBackend ) ProtocolVersion () int {
200200 return b .eth .EthVersion ()
201201}
202202
203- func (b * EthApiBackend ) SuggestPrice (ctx context.Context ) (* big.Int , error ) {
203+ func (b * EthAPIBackend ) SuggestPrice (ctx context.Context ) (* big.Int , error ) {
204204 return b .gpo .SuggestPrice (ctx )
205205}
206206
207- func (b * EthApiBackend ) ChainDb () ethdb.Database {
207+ func (b * EthAPIBackend ) ChainDb () ethdb.Database {
208208 return b .eth .ChainDb ()
209209}
210210
211- func (b * EthApiBackend ) EventMux () * event.TypeMux {
211+ func (b * EthAPIBackend ) EventMux () * event.TypeMux {
212212 return b .eth .EventMux ()
213213}
214214
215- func (b * EthApiBackend ) AccountManager () * accounts.Manager {
215+ func (b * EthAPIBackend ) AccountManager () * accounts.Manager {
216216 return b .eth .AccountManager ()
217217}
218218
219- func (b * EthApiBackend ) BloomStatus () (uint64 , uint64 ) {
219+ func (b * EthAPIBackend ) BloomStatus () (uint64 , uint64 ) {
220220 sections , _ , _ := b .eth .bloomIndexer .Sections ()
221221 return params .BloomBitsBlocks , sections
222222}
223223
224- func (b * EthApiBackend ) ServiceFilter (ctx context.Context , session * bloombits.MatcherSession ) {
224+ func (b * EthAPIBackend ) ServiceFilter (ctx context.Context , session * bloombits.MatcherSession ) {
225225 for i := 0 ; i < bloomFilterThreads ; i ++ {
226226 go session .Multiplex (bloomRetrievalBatch , bloomRetrievalWait , b .eth .bloomRequests )
227227 }
0 commit comments