func (self *StateManager) ProcessTransactions(coinbase *ethstate.StateObject, state *ethstate.State, block, parent *Block, txs Transactions) (Receipts, Transactions, Transactions, error) { var ( receipts Receipts handled, unhandled Transactions totalUsedGas = big.NewInt(0) err error ) done: for i, tx := range txs { txGas := new(big.Int).Set(tx.Gas) cb := state.GetStateObject(coinbase.Address()) st := NewStateTransition(cb, tx, state, block) err = st.TransitionState() if err != nil { statelogger.Infoln(err) switch { case IsNonceErr(err): err = nil // ignore error continue case IsGasLimitErr(err): unhandled = txs[i:] break done default: statelogger.Infoln(err) err = nil //return nil, nil, nil, err } } // Notify all subscribers self.Ethereum.Reactor().Post("newTx:post", tx) // Update the state with pending changes state.Update() txGas.Sub(txGas, st.gas) accumelative := new(big.Int).Set(totalUsedGas.Add(totalUsedGas, txGas)) receipt := &Receipt{tx, ethutil.CopyBytes(state.Root().([]byte)), accumelative} if i < len(block.Receipts()) { original := block.Receipts()[i] if !original.Cmp(receipt) { return nil, nil, nil, fmt.Errorf("err diff #%d (r) %v ~ %x <=> (c) %v ~ %x (%x)\n", i+1, original.CumulativeGasUsed, original.PostState[0:4], receipt.CumulativeGasUsed, receipt.PostState[0:4], receipt.Tx.Hash()) } } receipts = append(receipts, receipt) handled = append(handled, tx) if ethutil.Config.Diff && ethutil.Config.DiffType == "all" { state.CreateOutputForDiff() } } parent.GasUsed = totalUsedGas return receipts, handled, unhandled, err }