Added missing whisper timestamp. Closes #284

pull/290/head
obscuren 10 years ago
parent 663d725026
commit 623469cb6c
  1. 7
      state/statedb.go
  2. 1
      whisper/message.go
  3. 4
      xeth/whisper.go

@ -31,7 +31,7 @@ type StateDB struct {
// Create a new state from a given trie // Create a new state from a given trie
func New(root []byte, db ethutil.Database) *StateDB { func New(root []byte, db ethutil.Database) *StateDB {
trie := trie.New(root, db) trie := trie.New(ethutil.CopyBytes(root), db)
return &StateDB{db: db, trie: trie, stateObjects: make(map[string]*StateObject), manifest: NewManifest(), refund: make(map[string]*big.Int)} return &StateDB{db: db, trie: trie, stateObjects: make(map[string]*StateObject), manifest: NewManifest(), refund: make(map[string]*big.Int)}
} }
@ -234,12 +234,9 @@ func (self *StateDB) Copy() *StateDB {
} }
func (self *StateDB) Set(state *StateDB) { func (self *StateDB) Set(state *StateDB) {
if state == nil {
panic("Tried setting 'state' to nil through 'Set'")
}
self.trie = state.trie self.trie = state.trie
self.stateObjects = state.stateObjects self.stateObjects = state.stateObjects
self.refund = state.refund self.refund = state.refund
self.logs = state.logs self.logs = state.logs
} }

@ -11,6 +11,7 @@ type Message struct {
Flags byte Flags byte
Signature []byte Signature []byte
Payload []byte Payload []byte
Sent uint64
} }
func NewMessage(payload []byte) *Message { func NewMessage(payload []byte) *Message {

@ -99,16 +99,16 @@ type Options struct {
type WhisperMessage struct { type WhisperMessage struct {
ref *whisper.Message ref *whisper.Message
Flags int32 `json:"flags"`
Payload string `json:"payload"` Payload string `json:"payload"`
From string `json:"from"` From string `json:"from"`
Sent uint64 `json:"time"`
} }
func NewWhisperMessage(msg *whisper.Message) WhisperMessage { func NewWhisperMessage(msg *whisper.Message) WhisperMessage {
return WhisperMessage{ return WhisperMessage{
ref: msg, ref: msg,
Flags: int32(msg.Flags),
Payload: "0x" + ethutil.Bytes2Hex(msg.Payload), Payload: "0x" + ethutil.Bytes2Hex(msg.Payload),
From: "0x" + ethutil.Bytes2Hex(crypto.FromECDSAPub(msg.Recover())), From: "0x" + ethutil.Bytes2Hex(crypto.FromECDSAPub(msg.Recover())),
Sent: msg.Sent,
} }
} }

Loading…
Cancel
Save