Skip to content

Commit

Permalink
Merge branch 'main' into gregor/height-boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
sideninja authored May 24, 2024
2 parents 05245f2 + ed51587 commit 010e2bb
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
3 changes: 3 additions & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ func SupportedAPIs(blockChainAPI *BlockChainAPI, streamAPI *StreamAPI, pullAPI *
}, {
Namespace: "net",
Service: &NetAPI{},
}, {
Namespace: "txpool",
Service: NewTxPoolAPI(),
}}
}

Expand Down
43 changes: 43 additions & 0 deletions api/pool.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package api

import (
"github.com/onflow/go-ethereum/common"
"github.com/onflow/go-ethereum/common/hexutil"
)

type TxPool struct{}

func NewTxPoolAPI() *TxPool {
return &TxPool{}
}

type content struct {
Pending any
Queued any
}

func emptyPool() content {
return content{
Pending: struct{}{},
Queued: struct{}{},
}
}

func (s *TxPool) Content() content {
return emptyPool()
}

func (s *TxPool) ContentFrom(addr common.Address) content {
return emptyPool()
}

func (s *TxPool) Status() map[string]hexutil.Uint {
return map[string]hexutil.Uint{
"pending": hexutil.Uint(0),
"queued": hexutil.Uint(0),
}
}

func (s *TxPool) Inspect() content {
return emptyPool()
}
15 changes: 11 additions & 4 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,17 @@ func (w *loggingResponseWriter) Write(data []byte) (int, error) {
_ = json.Unmarshal(data, &body)
delete(body, "jsonrpc")

w.logger.
Debug().
Fields(body).
Msg("API response")
if body["error"] != nil {
w.logger.
Error().
Fields(body).
Msg("API response")
} else {
w.logger.
Debug().
Fields(body).
Msg("API response")
}

return w.ResponseWriter.Write(data)
}
Expand Down

0 comments on commit 010e2bb

Please sign in to comment.