func (pool *TxPool) RemoveInvalid(state *ethstate.State) { for e := pool.pool.Front(); e != nil; e = e.Next() { tx := e.Value.(*Transaction) sender := state.GetAccount(tx.Sender()) err := pool.ValidateTransaction(tx) if err != nil || sender.Nonce >= tx.Nonce { pool.pool.Remove(e) } } }
func (sm *StateManager) AccumelateRewards(state *ethstate.State, block *Block) error { // Get the account associated with the coinbase account := state.GetAccount(block.Coinbase) // Reward amount of ether to the coinbase address account.AddAmount(CalculateBlockReward(block, len(block.Uncles))) addr := make([]byte, len(block.Coinbase)) copy(addr, block.Coinbase) state.UpdateStateObject(account) for _, uncle := range block.Uncles { uncleAccount := state.GetAccount(uncle.Coinbase) uncleAccount.AddAmount(CalculateUncleReward(uncle)) state.UpdateStateObject(uncleAccount) } return nil }