[blockchain] Do not rely on beaconchain for when not on shard0, use shardchain (#1840)

pull/1837/head
Edgar Aroutiounian 5 years ago committed by GitHub
parent 919e96b221
commit 6f1e144a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      node/worker/worker.go

@ -290,26 +290,26 @@ func (w *Worker) SuperCommitteeForNextEpoch(
nextCommittee shard.State nextCommittee shard.State
oops error oops error
) )
// WARN This currently not working and breaks around 15 block
switch shardID { // switch shardID {
case shard.BeaconChainShardID: // case shard.BeaconChainShardID:
if shard.Schedule.IsLastBlock(w.current.header.Number().Uint64()) { if shard.Schedule.IsLastBlock(w.current.header.Number().Uint64()) {
nextCommittee, oops = committee.WithStakingEnabled.Compute( nextCommittee, oops = committee.WithStakingEnabled.Compute(
new(big.Int).Add(w.current.header.Epoch(), common.Big1), new(big.Int).Add(w.current.header.Epoch(), common.Big1),
*w.config, *w.config,
beacon, beacon,
) )
}
default:
// WARN When we first enable staking, this condition may not be robust by itself.
switch beacon.CurrentHeader().Epoch().Cmp(w.current.header.Epoch()) {
case 1:
nextCommittee, oops = committee.WithStakingEnabled.ReadFromDB(
beacon.CurrentHeader().Epoch(), beacon,
)
}
} }
// default:
// WARN When we first enable staking, this condition may not be robust by itself.
// switch beacon.CurrentHeader().Epoch().Cmp(w.current.header.Epoch()) {
// case 1:
// nextCommittee, oops = committee.WithStakingEnabled.ReadFromDB(
// beacon.CurrentHeader().Epoch(), beacon,
// )
// }
// }
return nextCommittee, oops return nextCommittee, oops
} }

Loading…
Cancel
Save