Skip to content

Commit

Permalink
do not create new account for cx txn (#3391)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlan35 authored and Leo Chen committed Oct 16, 2020
1 parent 9cdfa94 commit f21b7d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,11 @@ func (db *DB) Prepare(thash, bhash common.Hash, ti int) {
}

func (db *DB) clearJournalAndRefund() {
db.journal = newJournal()
db.validRevisions = db.validRevisions[:0]
db.refund = 0
if len(db.journal.entries) > 0 {
db.journal = newJournal()
db.refund = 0
}
db.validRevisions = db.validRevisions[:0] // Snapshots can be created without journal entires
}

// Commit writes the state to the underlying in-memory trie database.
Expand Down
2 changes: 1 addition & 1 deletion core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
to = AccountRef(addr)
snapshot = evm.StateDB.Snapshot()
)
if !evm.StateDB.Exist(addr) {
if !evm.StateDB.Exist(addr) && txType != types.SubtractionOnly {
precompiles := PrecompiledContractsHomestead
if evm.ChainConfig().IsS3(evm.EpochNumber) {
precompiles = PrecompiledContractsByzantium
Expand Down

0 comments on commit f21b7d6

Please sign in to comment.