diff options
-rw-r--r-- | core/blockchain.go | 9 | ||||
-rw-r--r-- | core/events.go | 6 | ||||
-rw-r--r-- | internal/ethapi/api.go | 6 | ||||
-rw-r--r-- | light/lightchain.go | 3 |
4 files changed, 6 insertions, 18 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index d6f2653ae..cab923bca 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -628,7 +628,6 @@ type WriteStatus byte const ( NonStatTy WriteStatus = iota CanonStatTy - SplitStatTy SideStatTy ) @@ -1029,9 +1028,6 @@ func (self *BlockChain) InsertChain(chain types.Blocks) (int, error) { blockInsertTimer.UpdateSince(bstart) events = append(events, ChainSideEvent{block}) - - case SplitStatTy: - events = append(events, ChainSplitEvent{block, logs}) } stats.processed++ stats.usedGas += usedGas.Uint64() @@ -1226,8 +1222,9 @@ func (self *BlockChain) postChainEvents(events []interface{}, logs []*types.Log) self.eventMux.Post(logs) for _, event := range events { if event, ok := event.(ChainEvent); ok { - // We need some control over the mining operation. Acquiring locks and waiting for the miner to create new block takes too long - // and in most cases isn't even necessary. + // We need some control over the mining operation. Acquiring locks and waiting + // for the miner to create new block takes too long and in most cases isn't + // even necessary. if self.LastBlockHash() == event.Hash { self.eventMux.Post(ChainHeadEvent{event.Block}) } diff --git a/core/events.go b/core/events.go index 31ad8364b..106b52c80 100644 --- a/core/events.go +++ b/core/events.go @@ -46,12 +46,6 @@ type RemovedTransactionEvent struct{ Txs types.Transactions } // RemovedLogEvent is posted when a reorg happens type RemovedLogsEvent struct{ Logs []*types.Log } -// ChainSplit is posted when a new head is detected -type ChainSplitEvent struct { - Block *types.Block - Logs []*types.Log -} - type ChainEvent struct { Block *types.Block Hash common.Hash diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 987e14419..f0bc3aa4b 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -191,7 +191,7 @@ func NewPublicAccountAPI(am *accounts.Manager) *PublicAccountAPI { // Accounts returns the collection of accounts this node manages func (s *PublicAccountAPI) Accounts() []common.Address { - var addresses []common.Address + addresses := make([]common.Address, 0) // return [] instead of nil if empty for _, wallet := range s.am.Wallets() { for _, account := range wallet.Accounts() { addresses = append(addresses, account.Address) @@ -218,7 +218,7 @@ func NewPrivateAccountAPI(b Backend) *PrivateAccountAPI { // ListAccounts will return a list of addresses for accounts this node manages. func (s *PrivateAccountAPI) ListAccounts() []common.Address { - var addresses []common.Address + addresses := make([]common.Address, 0) // return [] instead of nil if empty for _, wallet := range s.am.Wallets() { for _, account := range wallet.Accounts() { addresses = append(addresses, account.Address) @@ -237,7 +237,7 @@ type rawWallet struct { // ListWallets will return a list of wallets this node manages. func (s *PrivateAccountAPI) ListWallets() []rawWallet { - var wallets []rawWallet + wallets := make([]rawWallet, 0) // return [] instead of nil if empty for _, wallet := range s.am.Wallets() { wallets = append(wallets, rawWallet{ URL: wallet.URL().String(), diff --git a/light/lightchain.go b/light/lightchain.go index e8fd0ba5e..5b7e57041 100644 --- a/light/lightchain.go +++ b/light/lightchain.go @@ -377,9 +377,6 @@ func (self *LightChain) InsertHeaderChain(chain []*types.Header, checkFreq int) case core.SideStatTy: log.Debug("Inserted forked header", "number", header.Number, "hash", header.Hash()) events = append(events, core.ChainSideEvent{Block: types.NewBlockWithHeader(header)}) - - case core.SplitStatTy: - events = append(events, core.ChainSplitEvent{Block: types.NewBlockWithHeader(header)}) } return err } |