MCPcopy Create free account
hub / github.com/ethstorage/es-node / waitForMined

Function waitForMined

integration_tests/node_mine_test.go:169–187  ·  view source on GitHub ↗
(l1api miner.L1API, contract common.Address, chainHeadCh chan eth.L1BlockRef, shardIdx uint64, exitCh chan uint64)

Source from the content-addressed store, hash-verified

167}
168
169func waitForMined(l1api miner.L1API, contract common.Address, chainHeadCh chan eth.L1BlockRef, shardIdx uint64, exitCh chan uint64) {
170 for range chainHeadCh {
171 info, err := l1api.GetMiningInfo(
172 context.Background(),
173 contract,
174 shardIdx,
175 )
176 if err != nil {
177 lg.Warn("Failed to get es mining info", "error", err.Error())
178 continue
179 }
180 lg.Info("Starting shard mining", "shard", shardIdx, "lastMined", info.BlockMined, "blockNumber", info.LastMineTime)
181 if info.BlockMined.Uint64() > 0 {
182 lg.Info("Mined new", "shard", shardIdx, "justMined", info.BlockMined)
183 exitCh <- shardIdx
184 return
185 }
186 }
187}
188
189func initStorageConfig(t *testing.T, client *eth.PollingClient, l1Contract, miner common.Address) *storage.StorageConfig {
190 result, err := client.ReadContractField("maxKvSizeBits", nil)

Callers 1

TestMiningFunction · 0.85

Calls 2

GetMiningInfoMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected