MCPcopy Create free account
hub / github.com/CPChain/chain / commitTransaction

Method commitTransaction

miner/engine.go:576–595  ·  view source on GitHub ↗
(tx *types.Transaction, bc *core.BlockChain, coinbase common.Address, gp *core.GasPool)

Source from the content-addressed store, hash-verified

574}
575
576func (w *Work) commitTransaction(tx *types.Transaction, bc *core.BlockChain, coinbase common.Address, gp *core.GasPool) (error, []*types.Log) {
577 snap := w.pubState.Snapshot()
578 snapPriv := w.privState.Snapshot()
579
580 pubReceipt, privReceipt, _, err := core.ApplyTransaction(w.config, bc, &coinbase, gp, w.pubState, w.privState, w.remoteDB,
581 w.header, tx, &w.header.GasUsed, vm.Config{}, w.accm)
582 if err != nil {
583 w.pubState.RevertToSnapshot(snap)
584 w.privState.RevertToSnapshot(snapPriv)
585 return err, nil
586 }
587 w.txs = append(w.txs, tx)
588 w.pubReceipts = append(w.pubReceipts, pubReceipt)
589 if privReceipt != nil {
590 w.privReceipts = append(w.privReceipts, privReceipt)
591 }
592
593 // TODO: consider whether append private logs to returned logs together.
594 return nil, pubReceipt.Logs
595}

Callers 1

commitTransactionsMethod · 0.95

Calls 2

SnapshotMethod · 0.65
RevertToSnapshotMethod · 0.65

Tested by

no test coverage detected