API add slots endpoints

This commit is contained in:
laisolizq
2020-10-29 17:34:15 +01:00
parent 9ab50135d7
commit 5012b82914
10 changed files with 872 additions and 32 deletions

View File

@@ -329,9 +329,15 @@ func GenCoordinators(nCoords int, blocks []common.Block) []common.Coordinator {
// GenBids generates bids. WARNING: This is meant for DB/API testing, and may not be fully consistent with the protocol.
func GenBids(nBids int, blocks []common.Block, coords []common.Coordinator) []common.Bid {
bids := []common.Bid{}
for i := 0; i < nBids; i++ {
for i := 0; i < nBids*2; i = i + 2 { //nolint:gomnd
var slotNum int64
if i < nBids {
slotNum = int64(i)
} else {
slotNum = int64(i - nBids)
}
bids = append(bids, common.Bid{
SlotNum: int64(i),
SlotNum: slotNum,
BidValue: big.NewInt(int64(i)),
EthBlockNum: blocks[i%len(blocks)].EthBlockNum,
Bidder: coords[i%len(blocks)].Bidder,