aboutsummaryrefslogtreecommitdiffstats
path: root/state/manifest.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-31 21:43:14 +0800
committerobscuren <geffobscura@gmail.com>2014-10-31 21:43:14 +0800
commitaf8f5f0b69f1c359991d12c7708804fe8dd1f944 (patch)
treedd3d5bea8d57037a2d32fae86c4ba7fcc9161b16 /state/manifest.go
parent0ed1a8b50a9b9726cd57a2731d0405f6949c6188 (diff)
downloadgo-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar
go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar.gz
go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar.bz2
go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar.lz
go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar.xz
go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.tar.zst
go-tangerine-af8f5f0b69f1c359991d12c7708804fe8dd1f944.zip
ethstate => state
Diffstat (limited to 'state/manifest.go')
-rw-r--r--state/manifest.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/state/manifest.go b/state/manifest.go
new file mode 100644
index 000000000..21cd04a1a
--- /dev/null
+++ b/state/manifest.go
@@ -0,0 +1,55 @@
+package state
+
+import (
+ "fmt"
+ "math/big"
+)
+
+// Object manifest
+//
+// The object manifest is used to keep changes to the state so we can keep track of the changes
+// that occurred during a state transitioning phase.
+type Manifest struct {
+ Messages Messages
+}
+
+func NewManifest() *Manifest {
+ m := &Manifest{}
+ m.Reset()
+
+ return m
+}
+
+func (m *Manifest) Reset() {
+ m.Messages = nil
+}
+
+func (self *Manifest) AddMessage(msg *Message) *Message {
+ self.Messages = append(self.Messages, msg)
+
+ return msg
+}
+
+type Messages []*Message
+type Message struct {
+ To, From []byte
+ Input []byte
+ Output []byte
+ Path int
+ Origin []byte
+ Timestamp int64
+ Coinbase []byte
+ Block []byte
+ Number *big.Int
+ Value *big.Int
+
+ ChangedAddresses [][]byte
+}
+
+func (self *Message) AddStorageChange(addr []byte) {
+ self.ChangedAddresses = append(self.ChangedAddresses, addr)
+}
+
+func (self *Message) String() string {
+ return fmt.Sprintf("Message{to: %x from: %x input: %x output: %x origin: %x coinbase: %x block: %x number: %v timestamp: %d path: %d value: %v", self.To, self.From, self.Input, self.Output, self.Origin, self.Coinbase, self.Block, self.Number, self.Timestamp, self.Path, self.Value)
+}