From 819aaf5b70dddf49aebeeab6567d7fb136b24a11 Mon Sep 17 00:00:00 2001 From: jagdeep sidhu Date: Tue, 8 Oct 2024 11:41:04 -0700 Subject: [PATCH] cleanup --- consensus/beacon/consensus.go | 4 ++-- eth/backend.go | 10 ++-------- eth/downloader/peer.go | 14 -------------- params/config.go | 6 ++---- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/consensus/beacon/consensus.go b/consensus/beacon/consensus.go index 975693b167..c5c71a3af2 100644 --- a/consensus/beacon/consensus.go +++ b/consensus/beacon/consensus.go @@ -41,7 +41,7 @@ var ( beaconDifficulty = common.Big0 // The default block difficulty in the beacon consensus beaconNonce = types.EncodeNonce(0) // The default block nonce in the beacon consensus // SYSCOIN - SyscoinBlockReward, _ = new(big.Int).SetString("10550000000000000000", 10) // 10.55 Block reward for successfully mining a block upward from Syscoin + SyscoinBlockReward = uint256.NewInt(10550000000000000000) // 10.55 Block reward for successfully mining a block upward from Syscoin allowedFutureBlockTimeSeconds = int64(150) // Max seconds from current time allowed for blocks, before they're considered future blocks ) @@ -383,7 +383,7 @@ func (beacon *Beacon) Prepare(chain consensus.ChainHeaderReader, header *types.H // reward. The total reward consists of the static block reward and rewards for // included uncles. The coinbase of each uncle block is also rewarded. func accumulateRewards(stateDB *state.StateDB, header *types.Header) { - stateDB.AddBalance(header.Coinbase, uint256.MustFromBig(SyscoinBlockReward), tracing.BalanceIncreaseRewardMineBlock) + stateDB.AddBalance(header.Coinbase, SyscoinBlockReward, tracing.BalanceIncreaseRewardMineBlock) } // Finalize implements consensus.Engine and processes withdrawals on top. diff --git a/eth/backend.go b/eth/backend.go index f7bc11a0fd..56f46a34a2 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -377,9 +377,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { // ensure 5 seconds has passed between blocks before we start peering so we are sure sync has finished if time.Now().Unix()-eth.timeLastBlock >= 5 { log.Info("Networking and peering start...") - eth.handler.Start(eth.handler.maxPeers) eth.handler.peers.open() - eth.Downloader().Peers().Open() eth.p2pServer.Start() eth.Downloader().DoneEvent() eth.handler.synced.Store(true) @@ -532,19 +530,15 @@ func (s *Ethereum) Start() error { // Regularly update shutdown marker s.shutdownTracker.Start() - + // Start the networking layer + s.handler.Start(s.p2pServer.MaxPeers) // SYSCOIN if s.blockchain.GetChainConfig().SyscoinBlock != nil { log.Info("Skip networking and peering...") - s.handler.maxPeers = s.p2pServer.MaxPeers s.handler.peers.close() s.p2pServer.Stop() - } else { - // Start the networking layer - s.handler.Start(s.p2pServer.MaxPeers) } - return nil } diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go index aa4e28ef9b..9afef7cf54 100644 --- a/eth/downloader/peer.go +++ b/eth/downloader/peer.go @@ -233,20 +233,6 @@ func (ps *peerSet) Register(p *peerConnection) error { return nil } -// SYSCOIN -func (ps *peerSet) Close() { - ps.lock.Lock() - defer ps.lock.Unlock() - - ps.closed = true -} -func (ps *peerSet) Open() { - ps.lock.Lock() - defer ps.lock.Unlock() - - ps.closed = false -} - // Unregister removes a remote peer from the active set, disabling any further // actions to/from that particular entity. func (ps *peerSet) Unregister(id string) error { diff --git a/params/config.go b/params/config.go index 07342a2d12..d0acc6209c 100644 --- a/params/config.go +++ b/params/config.go @@ -38,8 +38,6 @@ func newUint64(val uint64) *uint64 { return &val } var ( MainnetTerminalTotalDifficulty, _ = new(big.Int).SetString("58_750_000_000_000_000_000_000", 0) - // SYSCOIN - SyscoinTerminalTotalDifficulty, _ = new(big.Int).SetString("0", 0) // MainnetChainConfig is the chain parameters to run a node on the main network. MainnetChainConfig = &ChainConfig{ @@ -85,11 +83,11 @@ var ( RolluxBlock: big.NewInt(268500), NexusBlock: big.NewInt(600000), LondonBlock: big.NewInt(1), - TerminalTotalDifficulty: SyscoinTerminalTotalDifficulty, + TerminalTotalDifficulty: big.NewInt(1), TerminalTotalDifficultyPassed: true, ShanghaiTime: newUint64(1679618404), CancunTime: newUint64(1679618404), - Ethash: nil, + Ethash: nil, } TanenbaumChainConfig = &ChainConfig{ ChainID: big.NewInt(5700),