[release/1.4.16] core/state: implement reverts by journaling all changes

This commit replaces the deep-copy based state revert mechanism with a
linear complexity journal. This commit also hides several internal
StateDB methods to limit the number of ways in which calling code can
use the journal incorrectly.

As usual consultation and bug fixes to the initial implementation were
provided by @karalabe, @obscuren and @Arachnid. Thank you!

(cherry picked from commit 1f1ea18b54)
This commit is contained in:
Felix Lange
2016-10-04 12:36:02 +02:00
parent e97b30169b
commit 46a527d014
22 changed files with 661 additions and 242 deletions

View File

@ -36,9 +36,9 @@ type Environment interface {
// The state database
Db() Database
// Creates a restorable snapshot
MakeSnapshot() Database
SnapshotDatabase() int
// Set database to previous snapshot
SetSnapshot(Database)
RevertToSnapshot(int)
// Address of the original invoker (first occurrence of the VM invoker)
Origin() common.Address
// The block number this VM is invoked on