arnaucube
arnaucube/hermez-nodePublic Self-hosted repository
Stop using hardcoded bootcoordinator in api
Arnau B arnaubennassar5@gmail.com
Thu, 14 Jan 2021 16:00:44 +0100
commit

5ff42220ced1ec48e9e4edeff90a83544327ea04

parent

8f6b081f2ce2eea4aa7e59d65ade662d7be7b257

2 files changed, 6 insertions(+), 12 deletions(-)

jump to
M api/api_test.go → api/api_test.go

@@ -465,9 +465,8 @@ panic(err)

} bootForger := NextForger{ Coordinator: historydb.CoordinatorAPI{ - Bidder: ethCommon.HexToAddress("0x0111111111111111111111111111111111111111"), - Forger: ethCommon.HexToAddress("0x0111111111111111111111111111111111111111"), - URL: "https://bootCoordinator", + Forger: auctionVars.BootCoordinator, + URL: auctionVars.BootCoordinatorURL, }, } // Set next forgers: set all as boot coordinator then replace the non boot coordinators
M api/state.go → api/state.go

@@ -7,7 +7,6 @@ "math/big"

"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"

@@ -37,13 +36,6 @@ FromBlock int64 `json:"fromBlock"`

ToBlock int64 `json:"toBlock"` FromTimestamp time.Time `json:"fromTimestamp"` 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) {

@@ -266,7 +258,10 @@ }

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