Skip to content

Commit

Permalink
Fixes ethereum#60
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed May 28, 2014
1 parent a98e35d commit b695c82
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions ethchain/state_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ func (sm *StateManager) ApplyTransactions(state *State, block *Block, txs []*Tra
for _, tx := range txs {
usedGas, err := sm.ApplyTransaction(state, block, tx)
if err != nil {
if IsNonceErr(err) {
continue
}

ethutil.Config.Log.Infoln(err)
//continue
}

accumelative := new(big.Int).Set(totalUsedGas.Add(totalUsedGas, usedGas))
Expand All @@ -116,7 +119,7 @@ func (sm *StateManager) ApplyTransactions(state *State, block *Block, txs []*Tra
validTxs = append(validTxs, tx)
}

return receipts, txs
return receipts, validTxs
}

func (sm *StateManager) ApplyTransaction(state *State, block *Block, tx *Transaction) (totalGasUsed *big.Int, err error) {
Expand Down
4 changes: 2 additions & 2 deletions ethchain/transaction_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, state *State, toContract
sender := state.GetAccount(tx.Sender())

if sender.Nonce != tx.Nonce {
err = fmt.Errorf("[TXPL] Invalid account nonce, state nonce is %d transaction nonce is %d instead", sender.Nonce, tx.Nonce)
err = NonceError(tx.Nonce, sender.Nonce)
return
}

Expand Down Expand Up @@ -235,7 +235,7 @@ func (pool *TxPool) RemoveInvalid(state *State) {
tx := e.Value.(*Transaction)
sender := state.GetAccount(tx.Sender())
err := pool.ValidateTransaction(tx)
if err != nil || sender.Nonce != tx.Nonce {
if err != nil || sender.Nonce >= tx.Nonce {
pool.pool.Remove(e)
}
}
Expand Down

0 comments on commit b695c82

Please sign in to comment.