Skip to content

Commit 94cbe8d

Browse files
committed
Attempt to resolve @pmikolajczyk41 and @ganeshvanahalli concerns
1 parent b790365 commit 94cbe8d

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

arbitrum/apibackend.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,14 @@ func createRegisterAPIBackend(backend *Backend, filterConfig filters.Config, fal
150150
archiveClientsManager: archiveClientsManager,
151151
}
152152
filterSystem := filters.NewFilterSystem(backend.apiBackend, filterConfig)
153-
apis, receiptFetcher := backend.apiBackend.GetAPIs(filterSystem)
153+
apis := backend.apiBackend.GetAPIs(filterSystem)
154+
transactionAPI := ethapi.GetTransactionAPI(backend.apiBackend)
155+
apis = append(apis, rpc.API{
156+
Namespace: "eth",
157+
Service: transactionAPI,
158+
})
154159
backend.stack.RegisterAPIs(apis)
155-
return filterSystem, receiptFetcher, nil
160+
return filterSystem, transactionAPI, nil
156161
}
157162

158163
func (a *APIBackend) SetSyncBackend(sync SyncProgressBackend) error {
@@ -163,8 +168,8 @@ func (a *APIBackend) SetSyncBackend(sync SyncProgressBackend) error {
163168
return nil
164169
}
165170

166-
func (a *APIBackend) GetAPIs(filterSystem *filters.FilterSystem) ([]rpc.API, ReceiptFetcher) {
167-
apis, transactionAPI := ethapi.GetAPIs(a)
171+
func (a *APIBackend) GetAPIs(filterSystem *filters.FilterSystem) []rpc.API {
172+
apis := ethapi.GetAPIs(a)
168173

169174
apis = append(apis, rpc.API{
170175
Namespace: "eth",
@@ -196,7 +201,7 @@ func (a *APIBackend) GetAPIs(filterSystem *filters.FilterSystem) ([]rpc.API, Rec
196201

197202
apis = append(apis, tracers.APIs(a)...)
198203

199-
return apis, transactionAPI
204+
return apis
200205
}
201206

202207
func (a *APIBackend) BlockChain() *core.BlockChain {

eth/backend.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ func makeExtraData(extra []byte) []byte {
394394
// APIs return the collection of RPC services the ethereum package offers.
395395
// NOTE, some of these services probably need to be moved to somewhere else.
396396
func (s *Ethereum) APIs() []rpc.API {
397-
apis, _ := ethapi.GetAPIs(s.APIBackend)
397+
apis := ethapi.GetAPIs(s.APIBackend)
398398

399399
// Append all the local APIs and return
400400
return append(apis, []rpc.API{
@@ -404,6 +404,9 @@ func (s *Ethereum) APIs() []rpc.API {
404404
}, {
405405
Namespace: "eth",
406406
Service: downloader.NewDownloaderAPI(s.handler.downloader, s.blockchain, s.eventMux),
407+
}, {
408+
Namespace: "eth",
409+
Service: ethapi.GetTransactionAPI(s.APIBackend),
407410
}, {
408411
Namespace: "admin",
409412
Service: NewAdminAPI(s),

internal/ethapi/backend.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,19 @@ type Backend interface {
108108
NewMatcherBackend() filtermaps.MatcherBackend
109109
}
110110

111-
func GetAPIs(apiBackend Backend) ([]rpc.API, *TransactionAPI) {
111+
func GetTransactionAPI(apiBackend Backend) *TransactionAPI {
112112
nonceLock := new(AddrLocker)
113-
transactionAPI := NewTransactionAPI(apiBackend, nonceLock)
113+
return NewTransactionAPI(apiBackend, nonceLock)
114+
}
115+
116+
func GetAPIs(apiBackend Backend) []rpc.API {
114117
return []rpc.API{
115118
{
116119
Namespace: "eth",
117120
Service: NewEthereumAPI(apiBackend),
118121
}, {
119122
Namespace: "eth",
120123
Service: NewBlockChainAPI(apiBackend),
121-
}, {
122-
Namespace: "eth",
123-
Service: transactionAPI,
124124
}, {
125125
Namespace: "txpool",
126126
Service: NewTxPoolAPI(apiBackend),
@@ -131,5 +131,5 @@ func GetAPIs(apiBackend Backend) ([]rpc.API, *TransactionAPI) {
131131
Namespace: "eth",
132132
Service: NewEthereumAccountAPI(apiBackend.AccountManager()),
133133
},
134-
}, transactionAPI
134+
}
135135
}

0 commit comments

Comments
 (0)