pull/150/head
obscuren 11 years ago
parent a98e35d7a0
commit b695c82520
  1. 7
      ethchain/state_manager.go
  2. 4
      ethchain/transaction_pool.go

@ -105,8 +105,11 @@ func (sm *StateManager) ApplyTransactions(state *State, block *Block, txs []*Tra
for _, tx := range txs { for _, tx := range txs {
usedGas, err := sm.ApplyTransaction(state, block, tx) usedGas, err := sm.ApplyTransaction(state, block, tx)
if err != nil { if err != nil {
if IsNonceErr(err) {
continue
}
ethutil.Config.Log.Infoln(err) ethutil.Config.Log.Infoln(err)
//continue
} }
accumelative := new(big.Int).Set(totalUsedGas.Add(totalUsedGas, usedGas)) accumelative := new(big.Int).Set(totalUsedGas.Add(totalUsedGas, usedGas))
@ -116,7 +119,7 @@ func (sm *StateManager) ApplyTransactions(state *State, block *Block, txs []*Tra
validTxs = append(validTxs, tx) 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) { func (sm *StateManager) ApplyTransaction(state *State, block *Block, tx *Transaction) (totalGasUsed *big.Int, err error) {

@ -106,7 +106,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, state *State, toContract
sender := state.GetAccount(tx.Sender()) sender := state.GetAccount(tx.Sender())
if sender.Nonce != tx.Nonce { 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 return
} }
@ -235,7 +235,7 @@ func (pool *TxPool) RemoveInvalid(state *State) {
tx := e.Value.(*Transaction) tx := e.Value.(*Transaction)
sender := state.GetAccount(tx.Sender()) sender := state.GetAccount(tx.Sender())
err := pool.ValidateTransaction(tx) err := pool.ValidateTransaction(tx)
if err != nil || sender.Nonce != tx.Nonce { if err != nil || sender.Nonce >= tx.Nonce {
pool.pool.Remove(e) pool.pool.Remove(e)
} }
} }

Loading…
Cancel
Save