@@ -207,7 +207,7 @@ func (s *StateDB) Error() error {
207207}
208208
209209func (s * StateDB ) AddLog (log * types.Log ) {
210- s .journal .append ( addLogChange { txhash : s .thash } )
210+ s .journal .JournalLog ( s .thash )
211211
212212 log .TxHash = s .thash
213213 log .TxIndex = uint (s .txIndex )
@@ -238,7 +238,7 @@ func (s *StateDB) Logs() []*types.Log {
238238// AddPreimage records a SHA3 preimage seen by the VM.
239239func (s * StateDB ) AddPreimage (hash common.Hash , preimage []byte ) {
240240 if _ , ok := s .preimages [hash ]; ! ok {
241- s .journal .append ( addPreimageChange { hash : hash } )
241+ s .journal .JournalAddPreimage ( hash )
242242 pi := make ([]byte , len (preimage ))
243243 copy (pi , preimage )
244244 s .preimages [hash ] = pi
@@ -252,14 +252,14 @@ func (s *StateDB) Preimages() map[common.Hash][]byte {
252252
253253// AddRefund adds gas to the refund counter
254254func (s * StateDB ) AddRefund (gas uint64 ) {
255- s .journal .append ( refundChange { prev : s .refund } )
255+ s .journal .JournalRefund ( s .refund )
256256 s .refund += gas
257257}
258258
259259// SubRefund removes gas from the refund counter.
260260// This method will panic if the refund counter goes below zero
261261func (s * StateDB ) SubRefund (gas uint64 ) {
262- s .journal .append ( refundChange { prev : s .refund } )
262+ s .journal .JournalRefundChange ( s .refund )
263263 if gas > s .refund {
264264 panic (fmt .Sprintf ("Refund counter below zero (gas: %d > refund: %d)" , gas , s .refund ))
265265 }
@@ -447,11 +447,7 @@ func (s *StateDB) SelfDestruct(addr common.Address) {
447447 if stateObject == nil {
448448 return
449449 }
450- s .journal .append (selfDestructChange {
451- account : & addr ,
452- prev : stateObject .selfDestructed ,
453- prevbalance : new (uint256.Int ).Set (stateObject .Balance ()),
454- })
450+ s .journal .JournalDestruct (addr , stateObject .selfDestructed , stateObject .Balance ())
455451 stateObject .markSelfdestructed ()
456452 stateObject .data .Balance = new (uint256.Int )
457453}
@@ -475,11 +471,7 @@ func (s *StateDB) SetTransientState(addr common.Address, key, value common.Hash)
475471 if prev == value {
476472 return
477473 }
478- s .journal .append (transientStorageChange {
479- account : & addr ,
480- key : key ,
481- prevalue : prev ,
482- })
474+ s .journal .JournalSetTransientState (addr , key , prev )
483475 s .setTransientState (addr , key , value )
484476}
485477
@@ -629,7 +621,7 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject)
629621 prev = s .getDeletedStateObject (addr ) // Note, prev might have been deleted, we need that!
630622 newobj = newObject (s , addr , nil )
631623 if prev == nil {
632- s .journal .append ( createObjectChange { account : & addr } )
624+ s .journal .JournalCreate ( addr )
633625 } else {
634626 // The original account should be marked as destructed and all cached
635627 // account and storage data should be cleared as well. Note, it must
@@ -643,16 +635,10 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject)
643635 // will be called for each transaction before byzantium fork which will always
644636 // cache the latest account/storage data.
645637 prevAccount , ok := s .accountsOrigin [prev .address ]
646- s .journal .append (resetObjectChange {
647- account : & addr ,
648- prev : prev ,
649- prevdestruct : prevdestruct ,
650- prevAccount : s .accounts [prev .addrHash ],
651- prevStorage : s .storages [prev .addrHash ],
652- prevAccountOriginExist : ok ,
653- prevAccountOrigin : prevAccount ,
654- prevStorageOrigin : s .storagesOrigin [prev .address ],
655- })
638+ s .journal .JournalReset (addr , prev , prevdestruct ,
639+ s .accounts [prev .addrHash ], s .storages [prev .addrHash ], ok ,
640+ prevAccount , s .storagesOrigin [prev .address ])
641+
656642 delete (s .accounts , prev .addrHash )
657643 delete (s .storages , prev .addrHash )
658644 delete (s .accountsOrigin , prev .address )
@@ -1342,7 +1328,7 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d
13421328// AddAddressToAccessList adds the given address to the access list
13431329func (s * StateDB ) AddAddressToAccessList (addr common.Address ) {
13441330 if s .accessList .AddAddress (addr ) {
1345- s .journal .append ( accessListAddAccountChange { & addr } )
1331+ s .journal .JournalAccessListAddAccount ( addr )
13461332 }
13471333}
13481334
@@ -1354,13 +1340,10 @@ func (s *StateDB) AddSlotToAccessList(addr common.Address, slot common.Hash) {
13541340 // scope of 'address' without having the 'address' become already added
13551341 // to the access list (via call-variant, create, etc).
13561342 // Better safe than sorry, though
1357- s .journal .append ( accessListAddAccountChange { & addr } )
1343+ s .journal .JournalAccessListAddAccount ( addr )
13581344 }
13591345 if slotMod {
1360- s .journal .append (accessListAddSlotChange {
1361- address : & addr ,
1362- slot : & slot ,
1363- })
1346+ s .journal .JournalAccessListAddSlot (addr , slot )
13641347 }
13651348}
13661349
0 commit comments