Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
d670c861
Commit
d670c861
authored
Mar 19, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Log to LogRes
parent
0685810e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
api.go
rpc/api.go
+3
-3
responses.go
rpc/responses.go
+26
-0
util.go
rpc/util.go
+0
-26
No files found.
rpc/api.go
View file @
d670c861
...
@@ -208,7 +208,7 @@ func (self *EthereumApi) FilterChanged(id int, reply *interface{}) error {
...
@@ -208,7 +208,7 @@ func (self *EthereumApi) FilterChanged(id int, reply *interface{}) error {
defer
self
.
logMut
.
Unlock
()
defer
self
.
logMut
.
Unlock
()
if
self
.
logs
[
id
]
!=
nil
{
if
self
.
logs
[
id
]
!=
nil
{
*
reply
=
toLog
s
(
self
.
logs
[
id
]
.
get
())
*
reply
=
NewLogsRe
s
(
self
.
logs
[
id
]
.
get
())
}
}
return
nil
return
nil
...
@@ -220,7 +220,7 @@ func (self *EthereumApi) Logs(id int, reply *interface{}) error {
...
@@ -220,7 +220,7 @@ func (self *EthereumApi) Logs(id int, reply *interface{}) error {
filter
:=
self
.
filterManager
.
GetFilter
(
id
)
filter
:=
self
.
filterManager
.
GetFilter
(
id
)
if
filter
!=
nil
{
if
filter
!=
nil
{
*
reply
=
toLog
s
(
filter
.
Find
())
*
reply
=
NewLogsRe
s
(
filter
.
Find
())
}
}
return
nil
return
nil
...
@@ -230,7 +230,7 @@ func (self *EthereumApi) AllLogs(args *FilterOptions, reply *interface{}) error
...
@@ -230,7 +230,7 @@ func (self *EthereumApi) AllLogs(args *FilterOptions, reply *interface{}) error
filter
:=
core
.
NewFilter
(
self
.
xeth
()
.
Backend
())
filter
:=
core
.
NewFilter
(
self
.
xeth
()
.
Backend
())
filter
.
SetOptions
(
toFilterOptions
(
args
))
filter
.
SetOptions
(
toFilterOptions
(
args
))
*
reply
=
toLog
s
(
filter
.
Find
())
*
reply
=
NewLogsRe
s
(
filter
.
Find
())
return
nil
return
nil
}
}
...
...
rpc/responses.go
View file @
d670c861
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/state"
)
)
type
BlockRes
struct
{
type
BlockRes
struct
{
...
@@ -211,3 +212,28 @@ type FilterWhisperRes struct {
...
@@ -211,3 +212,28 @@ type FilterWhisperRes struct {
Payload
string
`json:"payload"`
Payload
string
`json:"payload"`
WorkProved
string
`json:"workProved"`
WorkProved
string
`json:"workProved"`
}
}
type
LogRes
struct
{
Address
string
`json:"address"`
Topic
[]
string
`json:"topic"`
Data
string
`json:"data"`
Number
uint64
`json:"number"`
}
func
NewLogsRes
(
logs
state
.
Logs
)
(
ls
[]
LogRes
)
{
ls
=
make
([]
LogRes
,
len
(
logs
))
for
i
,
log
:=
range
logs
{
var
l
LogRes
l
.
Topic
=
make
([]
string
,
len
(
log
.
Topics
()))
l
.
Address
=
common
.
ToHex
(
log
.
Address
())
l
.
Data
=
common
.
ToHex
(
log
.
Data
())
l
.
Number
=
log
.
Number
()
for
j
,
topic
:=
range
log
.
Topics
()
{
l
.
Topic
[
j
]
=
common
.
ToHex
(
topic
)
}
ls
[
i
]
=
l
}
return
}
rpc/util.go
View file @
d670c861
...
@@ -19,7 +19,6 @@ package rpc
...
@@ -19,7 +19,6 @@ package rpc
import
(
import
(
"time"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
...
@@ -27,31 +26,6 @@ import (
...
@@ -27,31 +26,6 @@ import (
var
rpclogger
=
logger
.
NewLogger
(
"RPC"
)
var
rpclogger
=
logger
.
NewLogger
(
"RPC"
)
type
Log
struct
{
Address
string
`json:"address"`
Topic
[]
string
`json:"topic"`
Data
string
`json:"data"`
Number
uint64
`json:"number"`
}
func
toLogs
(
logs
state
.
Logs
)
(
ls
[]
Log
)
{
ls
=
make
([]
Log
,
len
(
logs
))
for
i
,
log
:=
range
logs
{
var
l
Log
l
.
Topic
=
make
([]
string
,
len
(
log
.
Topics
()))
l
.
Address
=
common
.
ToHex
(
log
.
Address
())
l
.
Data
=
common
.
ToHex
(
log
.
Data
())
l
.
Number
=
log
.
Number
()
for
j
,
topic
:=
range
log
.
Topics
()
{
l
.
Topic
[
j
]
=
common
.
ToHex
(
topic
)
}
ls
[
i
]
=
l
}
return
}
type
whisperFilter
struct
{
type
whisperFilter
struct
{
messages
[]
xeth
.
WhisperMessage
messages
[]
xeth
.
WhisperMessage
timeout
time
.
Time
timeout
time
.
Time
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment