Fix comments

pull/1493/head
Rongjian Lan 5 years ago
parent 54111b60d7
commit 586b6a7822
  1. 4
      api/service/staking/service.go
  2. 16
      core/resharding.go
  3. 4
      internal/keystore/keystore.go
  4. 5
      internal/params/config.go
  5. 2
      node/node_newblock.go

@ -222,8 +222,8 @@ func (s *Service) createRawStakingMessage() []byte {
)
// This is currently not called.
hmykey.Unlock(s.account)
if signedTx, err := hmykey.SignTx(s.account, tx); err == nil {
chainID := big.NewInt(1) // TODO: wire the correct chain ID after staking flow is revamped.
if signedTx, err := hmykey.SignTx(s.account, tx, chainID); err == nil {
ts := types.Transactions{signedTx}
return constructStakingMessage(ts)
}

@ -133,21 +133,6 @@ func Shuffle(list []shard.NodeID) {
})
}
// GetBlockNumberFromEpoch calculates the block number where epoch sharding information is stored
// TODO lc - use ShardingSchedule function
// WARNING:
//func GetBlockNumberFromEpoch(epoch uint64) uint64 {
// number := epoch * ShardingSchedule.BlocksPerEpoch() // currently we use the first block in each epoch
// return number
//}
// GetLastBlockNumberFromEpoch calculates the last block number for the given
// epoch. TODO ek – this is a temp hack.
// TODO lc - use ShardingSchedule function
//func GetLastBlockNumberFromEpoch(epoch uint64) uint64 {
// return (epoch+1)*ShardingSchedule.BlocksPerEpoch() - 1
//}
// GetEpochFromBlockNumber calculates the epoch number the block belongs to
func GetEpochFromBlockNumber(blockNumber uint64) uint64 {
return ShardingSchedule.CalcEpochNumber(blockNumber).Uint64()
@ -164,6 +149,7 @@ func GetShardingStateFromBlockChain(bc *BlockChain, epoch *big.Int) (*ShardingSt
}
shardState = shardState.DeepCopy()
// TODO(RJ,HB): use real randomness for resharding
//blockNumber := GetBlockNumberFromEpoch(epoch.Uint64())
//rndSeedBytes := bc.GetVdfByNumber(blockNumber)
rndSeed := uint64(0)

@ -41,9 +41,9 @@ func Unlock(account accounts.Account) {
}
// SignTx signs transaction using account key
func SignTx(account accounts.Account, tx *types.Transaction) (*types.Transaction, error) {
func SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
if hmyKeystore != nil {
return hmyKeystore.SignTx(account, tx, big.NewInt(1)) // TODO: use chainID from config
return hmyKeystore.SignTx(account, tx, chainID)
}
return tx, fmt.Errorf("un-initialized keystore")
}

@ -9,6 +9,7 @@ import (
// Genesis hashes to enforce below configs on.
var (
// TODO: populate with real genesis hash (sharded)
MainnetGenesisHash = common.HexToHash("0x")
TestnetGenesisHash = common.HexToHash("0x")
)
@ -31,9 +32,13 @@ var (
}
// AllProtocolChanges ...
// This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields.
AllProtocolChanges = &ChainConfig{big.NewInt(100), big.NewInt(0), big.NewInt(0), big.NewInt(0)}
// TestChainConfig ...
// This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields.
TestChainConfig = &ChainConfig{big.NewInt(99), big.NewInt(0), big.NewInt(0), big.NewInt(0)}
// TestRules ...

@ -50,7 +50,7 @@ func (node *Node) WaitForConsensusReadyV2(readySignal chan struct{}, stopChan ch
utils.Logger().Debug().
Uint64("blockNum", node.Blockchain().CurrentBlock().NumberU64()+1).
Msg("=========Proposing New Block==========")
Msg("PROPOSING NEW BLOCK ------------------------------------------------")
newBlock, err := node.proposeNewBlock()

Loading…
Cancel
Save