fiz: correções da pool

This commit is contained in:
Júnior
2025-06-17 18:26:14 -03:00
parent 682027d517
commit 9259f36e9c
31 changed files with 373 additions and 269 deletions

View File

@ -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)
}