Stop using hardcoded bootcoordinator in api

This commit is contained in:
Arnau B
2021-01-14 16:00:44 +01:00
parent 8f6b081f2c
commit 5ff42220ce
2 changed files with 6 additions and 12 deletions

View File

@@ -7,7 +7,6 @@ import (
"net/http"
"time"
ethCommon "github.com/ethereum/go-ethereum/common"
"github.com/gin-gonic/gin"
"github.com/hermeznetwork/hermez-node/apitypes"
"github.com/hermeznetwork/hermez-node/common"
@@ -39,13 +38,6 @@ type Period struct {
ToTimestamp time.Time `json:"toTimestamp"`
}
var bootCoordinator historydb.CoordinatorAPI = historydb.CoordinatorAPI{
ItemID: 0,
Bidder: ethCommon.HexToAddress("0x111111111111111111111111111111111111111"),
Forger: ethCommon.HexToAddress("0x111111111111111111111111111111111111111"),
URL: "https://bootCoordinator",
}
func (a *API) getState(c *gin.Context) {
// TODO: There are no events for the buckets information, so now this information will be 0
a.status.RLock()
@@ -266,7 +258,10 @@ func (a *API) getNextForgers(lastBlock common.Block, currentSlot, lastClosedSlot
}
// If there is no bid, the coordinator that will forge is boot coordinator
if !foundForger {
nextForger.Coordinator = bootCoordinator
nextForger.Coordinator = historydb.CoordinatorAPI{
Forger: a.status.Auction.BootCoordinator,
URL: a.status.Auction.BootCoordinatorURL,
}
}
nextForgers = append(nextForgers, nextForger)
}