diff --git a/frontend/src/routes/remote-nodes/+page.js b/frontend/src/routes/remote-nodes/+page.js index 6b207d1..358fccd 100644 --- a/frontend/src/routes/remote-nodes/+page.js +++ b/frontend/src/routes/remote-nodes/+page.js @@ -1,5 +1,5 @@ /** @type {import('./$types').PageLoad} */ -export async function load({ data }) { +export async function load() { return { // prettier-ignore meta: { @@ -20,7 +20,7 @@ export async function load({ data }) { }, { nettype: 'stagenet', - estimate_fee: 57000 + estimate_fee: 56000 }, { nettype: 'testnet', diff --git a/handler/response.go b/handler/response.go index 4ea209d..b7aafc8 100644 --- a/handler/response.go +++ b/handler/response.go @@ -131,12 +131,12 @@ func AddNode(c *fiber.Ctx) error { }) } -func NetFee(c *fiber.Ctx) error { +func NetFees(c *fiber.Ctx) error { moneroRepo := monero.New() return c.JSON(fiber.Map{ "status": "ok", "message": "Success", - "data": moneroRepo.NetFee(), + "data": moneroRepo.NetFees(), }) } diff --git a/handler/routes.go b/handler/routes.go index 71e404d..1be4a41 100644 --- a/handler/routes.go +++ b/handler/routes.go @@ -11,7 +11,7 @@ func V1Api(app *fiber.App) { v1.Post("/nodes", AddNode) v1.Get("/nodes/id/:id", MoneroNode) v1.Get("/nodes/logs", ProbeLogs) - v1.Get("/fees", NetFee) + v1.Get("/fees", NetFees) v1.Get("/countries", Countries) v1.Get("/job", CheckProber, GiveJob) v1.Post("/job", CheckProber, ProcessJob) diff --git a/internal/monero/monero.go b/internal/monero/monero.go index ef828f1..bf48bb7 100644 --- a/internal/monero/monero.go +++ b/internal/monero/monero.go @@ -19,7 +19,7 @@ type MoneroRepository interface { Node(id int) (Node, error) Add(protocol string, host string, port uint) error Nodes(QueryNodes) (Nodes, error) - NetFee() []NetFee + NetFees() []NetFee Countries() ([]Countries, error) GiveJob(acceptTor int) (Node, error) ProcessJob(report ProbeReport, proberId int64) error @@ -310,7 +310,9 @@ type NetFee struct { NodeCount int `json:"node_count" db:"node_count"` } -func (r *MoneroRepo) NetFee() []NetFee { +// Get majority net fee from database +func (r *MoneroRepo) NetFees() []NetFee { + // TODO: Create in-memory cache for this netTypes := [3]string{"mainnet", "stagenet", "testnet"} netFees := []NetFee{}