Replace post-consensus resharding with TODOs

pull/839/head
Eugene Kim 6 years ago
parent 3cb884e7e8
commit 26c1f753cc
  1. 26
      node/node_handler.go

@ -16,9 +16,6 @@ import (
"time" "time"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/harmony-one/harmony/core"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
pb "github.com/golang/protobuf/proto" pb "github.com/golang/protobuf/proto"
"github.com/harmony-one/bls/ffi/go/bls" "github.com/harmony-one/bls/ffi/go/bls"
@ -28,6 +25,7 @@ import (
"github.com/harmony-one/harmony/api/proto/message" "github.com/harmony-one/harmony/api/proto/message"
proto_node "github.com/harmony-one/harmony/api/proto/node" proto_node "github.com/harmony-one/harmony/api/proto/node"
"github.com/harmony-one/harmony/api/service" "github.com/harmony-one/harmony/api/service"
"github.com/harmony-one/harmony/core"
"github.com/harmony-one/harmony/core/types" "github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/crypto/pki" "github.com/harmony-one/harmony/crypto/pki"
nodeconfig "github.com/harmony-one/harmony/internal/configs/node" nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
@ -315,23 +313,11 @@ func (node *Node) PostConsensusProcessing(newBlock *types.Block) {
// TODO: update staking information once per epoch. // TODO: update staking information once per epoch.
node.UpdateStakingList(node.QueryStakeInfo()) node.UpdateStakingList(node.QueryStakeInfo())
node.printStakingList() node.printStakingList()
if core.IsEpochBlock(newBlock) { }
shardState := node.blockchain.StoreNewShardState(newBlock, &node.CurrentStakes) if core.IsEpochLastBlock(newBlock) {
if shardState != nil { // TODO ek – wait for beacon chain's last block to be available
if nodeconfig.GetDefaultConfig().IsLeader() { // TODO ek - retrieve the global resharding assignment
epochShardState := types.EpochShardState{Epoch: core.GetEpochFromBlockNumber(newBlock.NumberU64()), ShardState: shardState} // TODO ek – if needed, (start to) move to another shard
epochShardStateMessage := proto_node.ConstructEpochShardStateMessage(epochShardState)
// Broadcast new shard state
err := node.host.SendMessageToGroups([]p2p.GroupID{node.NodeConfig.GetClientGroupID()}, host.ConstructP2pMessage(byte(0), epochShardStateMessage))
if err != nil {
utils.GetLogInstance().Error("[Resharding] failed to broadcast shard state message", "group", node.NodeConfig.GetClientGroupID())
} else {
utils.GetLogInstance().Info("[Resharding] broadcasted shard state message to", "group", node.NodeConfig.GetClientGroupID())
}
}
node.processEpochShardState(&types.EpochShardState{Epoch: core.GetEpochFromBlockNumber(newBlock.NumberU64()), ShardState: shardState})
}
}
} }
} }

Loading…
Cancel
Save