diff options
author | Felix Lange <fjl@twurst.com> | 2015-12-15 00:38:10 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-12-15 00:38:10 +0800 |
commit | fa187a366dda1894179635eeec2a929bfacc4ad3 (patch) | |
tree | 4494d4dcded47dd49f2fe7374e85fefa9249246e /core/vm | |
parent | 787d71d6595df98586c625e82f4decb034215203 (diff) | |
parent | eae81465c1c815c317cd30e4de6bdf4d59df2340 (diff) | |
download | dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.gz dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.bz2 dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.lz dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.xz dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.tar.zst dexon-fa187a366dda1894179635eeec2a929bfacc4ad3.zip |
Merge pull request #2035 from bas-vk/rcp-v2-rebase
rpc: new RPC implementation with pub/sub support
Diffstat (limited to 'core/vm')
-rw-r--r-- | core/vm/log.go | 16 |
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 |