aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-10-15 22:07:19 +0800
committerBas van Kervel <bas@ethdev.com>2015-12-14 23:34:05 +0800
commiteae81465c1c815c317cd30e4de6bdf4d59df2340 (patch)
treeb6f4b7787967a58416171adb79fd12ac29d89577 /core/vm
parent8db9d44ca9fb6baf406256cae491c475de2f4989 (diff)
downloaddexon-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar
dexon-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar.gz
dexon-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar.bz2
dexon-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar.lz
dexon-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar.xz
dexon-eae81465c1c815c317cd30e4de6bdf4d59df2340.tar.zst
dexon-eae81465c1c815c317cd30e4de6bdf4d59df2340.zip
rpc: new RPC implementation with pub/sub support
Diffstat (limited to 'core/vm')
-rw-r--r--core/vm/log.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/vm/log.go b/core/vm/log.go
index 191e3a253..e4cc6021b 100644
--- a/core/vm/log.go
+++ b/core/vm/log.go
@@ -17,6 +17,7 @@
package vm
import (
+ "encoding/json"
"fmt"
"io"
@@ -63,6 +64,21 @@ func (l *Log) String() string {
return fmt.Sprintf(`log: %x %x %x %x %d %x %d`, l.Address, l.Topics, l.Data, l.TxHash, l.TxIndex, l.BlockHash, l.Index)
}
+func (r *Log) MarshalJSON() ([]byte, error) {
+ fields := map[string]interface{}{
+ "address": r.Address,
+ "data": fmt.Sprintf("%#x", r.Data),
+ "blockNumber": fmt.Sprintf("%#x", r.BlockNumber),
+ "logIndex": fmt.Sprintf("%#x", r.Index),
+ "blockHash": r.BlockHash,
+ "transactionHash": r.TxHash,
+ "transactionIndex": fmt.Sprintf("%#x", r.TxIndex),
+ "topics": r.Topics,
+ }
+
+ return json.Marshal(fields)
+}
+
type Logs []*Log
// LogForStorage is a wrapper around a Log that flattens and parses the entire