Engine APIs registration¶
| Source (upstream v1.17.3) | Current | |
|---|---|---|
| File | eth/backend.go |
backend.go |
| Symbol | Ethereum.APIs |
Ethereum.APIs |
| Ref | v1.17.3 |
etc/v1.17.3-full-node |
Registers ethash engine APIs (eth_getWork, eth_submitWork, eth_submitHashrate, ethash_getHashrate) via type assertion on consensus.Engine. Upstream removed APIs() from the Engine interface; we restore registration using a local interface assertion.
Diff — vs upstream v1.17.3 (modified in-place)¶
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -3,9 +3,21 @@
func (s *Ethereum) APIs() []rpc.API {
apis := ethapi.GetAPIs(s.APIBackend)
+ // Register ethash engine APIs (eth_getWork, eth_submitWork, etc.) if available.
+ // Removed from consensus.Engine interface in upstream; restored for PoW chains.
+ type engineAPIs interface {
+ APIs(consensus.ChainHeaderReader) []rpc.API
+ }
+ if ea, ok := s.engine.(engineAPIs); ok {
+ apis = append(apis, ea.APIs(s.blockchain)...)
+ }
+
// Append all the local APIs and return
return append(apis, []rpc.API{
{
+ Namespace: "eth",
+ Service: NewEthereumAPI(s),
+ }, {
Namespace: "miner",
Service: NewMinerAPI(s),
}, {