Change estimate fee for stagenet to 56000

TODO: Create in-memory cache for NetFees function.
This commit is contained in:
ditatompel 2024-05-31 13:30:56 +07:00
parent e83045f8b5
commit 55f6af1f22
No known key found for this signature in database
GPG key ID: 31D3D06D77950979
4 changed files with 9 additions and 7 deletions

View file

@ -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',

View file

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

View file

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

View file

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