@@ -18,6 +18,7 @@ package state
18
18
19
19
import (
20
20
"github.com/ethereum/go-ethereum/common"
21
+ "github.com/ethereum/go-ethereum/core/types"
21
22
"github.com/holiman/uint256"
22
23
)
23
24
@@ -145,12 +146,10 @@ func (j *journal) JournalBalanceChange(addr common.Address, previous *uint256.In
145
146
})
146
147
}
147
148
148
- func (j * journal ) JournalSetCode (address common.Address , prevcode , prevHash []byte ) {
149
- j .append (codeChange {
150
- account : & address ,
151
- prevhash : prevHash ,
152
- prevcode : prevcode ,
153
- })
149
+ // JournalSetCode journals the setting of code: it is implicit that the previous
150
+ // values were "no code" and emptyCodeHash.
151
+ func (j * journal ) JournalSetCode (address common.Address ) {
152
+ j .append (codeChange {account : & address })
154
153
}
155
154
156
155
func (j * journal ) JournalNonceChange (address common.Address , prev uint64 ) {
@@ -228,8 +227,7 @@ type (
228
227
key , prevalue common.Hash
229
228
}
230
229
codeChange struct {
231
- account * common.Address
232
- prevcode , prevhash []byte
230
+ account * common.Address
233
231
}
234
232
235
233
// Changes to other state values.
@@ -330,7 +328,7 @@ func (ch nonceChange) dirtied() *common.Address {
330
328
}
331
329
332
330
func (ch codeChange ) revert (s * StateDB ) {
333
- s .getStateObject (* ch .account ).setCode (common . BytesToHash ( ch . prevhash ), ch . prevcode )
331
+ s .getStateObject (* ch .account ).setCode (types . EmptyCodeHash , nil )
334
332
}
335
333
336
334
func (ch codeChange ) dirtied () * common.Address {
0 commit comments