arnaucube
arnaucube/hermez-nodePublic Self-hosted repository
Merge pull request #486 from hermeznetwork/fix/api-hardcoded-bootcoordinator

Stop using hardcoded bootcoordinator in api
Eduard S eduard@iden3.io
Mon, 18 Jan 2021 18:04:25 +0100
commit

1ac2d783e90b090ae19d27d0091ff434eb9a2a95

parent

9ce4dd9b6d00a56b219363c340f81fb7de78dc32

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