fiz: correções da pool
This commit is contained in:
@ -1,20 +1,33 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"dejo_node/internal/mempool"
|
||||
"dejo_node/internal/staking"
|
||||
"dejo_node/internal/storage"
|
||||
"dejo_node/internal/transactions"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
Store *storage.BlockStore
|
||||
StakingStore *staking.StakingStore
|
||||
Mempool *mempool.Mempool
|
||||
Mempool *transactions.Mempool
|
||||
}
|
||||
|
||||
func NewHandler() *Handler {
|
||||
return &Handler{
|
||||
Store: storage.NewBlockStore("data/blocks.json"),
|
||||
StakingStore: staking.NewStakingStore(),
|
||||
}
|
||||
}
|
||||
return &Handler{}
|
||||
}
|
||||
|
||||
func (h *Handler) SetStores(blockStore *storage.BlockStore, stakingStore *staking.StakingStore, mempool *transactions.Mempool) {
|
||||
h.Store = blockStore
|
||||
h.StakingStore = stakingStore
|
||||
h.Mempool = mempool
|
||||
}
|
||||
|
||||
func (h *Handler) Ping(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte("pong"))
|
||||
}
|
||||
|
||||
func (h *Handler) HandleConsensus(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user