mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
parent
b53fa6c6d9
commit
81ac9cfb7e
4 changed files with 7 additions and 10 deletions
|
|
@ -65,7 +65,7 @@ func (x *XDPoS_v2) verifyHeader(chain consensus.ChainReader, header *types.Heade
|
||||||
if err != nil && parent.Number.Sign() != 0 { // skip genesis block
|
if err != nil && parent.Number.Sign() != 0 { // skip genesis block
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure gas used is less than or equal to gas limit
|
// Ensure gas used is less than or equal to gas limit
|
||||||
if header.GasUsed > header.GasLimit {
|
if header.GasUsed > header.GasLimit {
|
||||||
return fmt.Errorf("gas used exceeded gaslimit, gas used: %d, gas limit: %d", header.GasUsed, header.GasLimit)
|
return fmt.Errorf("gas used exceeded gaslimit, gas used: %d, gas limit: %d", header.GasUsed, header.GasLimit)
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig
|
||||||
genesis = DefaultGenesisBlock()
|
genesis = DefaultGenesisBlock()
|
||||||
}
|
}
|
||||||
// Ensure the stored genesis matches with the given one.
|
// Ensure the stored genesis matches with the given one.
|
||||||
hash := genesis.ToBlock(nil).Hash()
|
hash := genesis.ToBlock().Hash()
|
||||||
if hash != stored {
|
if hash != stored {
|
||||||
return genesis.Config, hash, &GenesisMismatchError{stored, hash}
|
return genesis.Config, hash, &GenesisMismatchError{stored, hash}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ func TestSetupGenesis(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "genesis header present but state missing",
|
name: "genesis header present but state missing",
|
||||||
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
||||||
block := DefaultGenesisBlock().ToBlock(nil)
|
block := DefaultGenesisBlock().ToBlock()
|
||||||
rawdb.WriteCanonicalHash(db, block.Hash(), 0)
|
rawdb.WriteCanonicalHash(db, block.Hash(), 0)
|
||||||
rawdb.WriteHeader(db, block.Header())
|
rawdb.WriteHeader(db, block.Header())
|
||||||
return SetupGenesisBlock(db, nil)
|
return SetupGenesisBlock(db, nil)
|
||||||
|
|
@ -132,7 +132,7 @@ func TestSetupGenesis(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "genesis block without chain config",
|
name: "genesis block without chain config",
|
||||||
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
||||||
block := DefaultGenesisBlock().ToBlock(db)
|
block := DefaultGenesisBlock().ToBlock()
|
||||||
rawdb.WriteBlock(db, block)
|
rawdb.WriteBlock(db, block)
|
||||||
rawdb.WriteCanonicalHash(db, block.Hash(), 0)
|
rawdb.WriteCanonicalHash(db, block.Hash(), 0)
|
||||||
return SetupGenesisBlock(db, nil)
|
return SetupGenesisBlock(db, nil)
|
||||||
|
|
@ -143,10 +143,7 @@ func TestSetupGenesis(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "missing block number for head header hash",
|
name: "missing block number for head header hash",
|
||||||
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
|
||||||
block := DefaultGenesisBlock().ToBlock(db)
|
DefaultGenesisBlock().MustCommit(db)
|
||||||
rawdb.WriteBlock(db, block)
|
|
||||||
rawdb.WriteCanonicalHash(db, block.Hash(), 0)
|
|
||||||
rawdb.WriteChainConfig(db, block.Hash(), params.XDCMainnetChainConfig)
|
|
||||||
rawdb.WriteHeadHeaderHash(db, common.HexToHash("0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"))
|
rawdb.WriteHeadHeaderHash(db, common.HexToHash("0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"))
|
||||||
return SetupGenesisBlock(db, nil)
|
return SetupGenesisBlock(db, nil)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -525,8 +525,8 @@ func (s *Service) login(conn *connWrapper) error {
|
||||||
auth := &authMsg{
|
auth := &authMsg{
|
||||||
ID: s.node,
|
ID: s.node,
|
||||||
Info: nodeInfo{
|
Info: nodeInfo{
|
||||||
Name: s.node,
|
Name: s.node,
|
||||||
Node: infos.Name,
|
Node: infos.Name,
|
||||||
Coinbase: s.coinbase,
|
Coinbase: s.coinbase,
|
||||||
Port: infos.Ports.Listener,
|
Port: infos.Ports.Listener,
|
||||||
Network: network,
|
Network: network,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue