good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
46ad5a5f
Commit
46ad5a5f
authored
9 years ago
by
Jeffrey Wilcke
Browse files
Options
Downloads
Plain Diff
Merge pull request #1852 from obscuren/filter-nil-fix
xeth: fixed nil pointer of filter retrieval
parents
9b940767
b9359981
Loading
Loading
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xeth/xeth.go
+34
-12
34 additions, 12 deletions
xeth/xeth.go
with
34 additions
and
12 deletions
xeth/xeth.go
+
34
−
12
View file @
46ad5a5f
...
...
@@ -532,8 +532,10 @@ func (self *XEth) NewLogFilter(earliest, latest int64, skip, max int, address []
self
.
logMu
.
Lock
()
defer
self
.
logMu
.
Unlock
()
var
id
int
filter
:=
core
.
NewFilter
(
self
.
backend
)
id
:=
self
.
filterManager
.
InstallFilter
(
filter
)
self
.
logQueue
[
id
]
=
&
logQueue
{
timeout
:
time
.
Now
()}
filter
.
SetEarliestBlock
(
earliest
)
filter
.
SetLatestBlock
(
latest
)
filter
.
SetSkip
(
skip
)
...
...
@@ -544,10 +546,10 @@ func (self *XEth) NewLogFilter(earliest, latest int64, skip, max int, address []
self
.
logMu
.
Lock
()
defer
self
.
logMu
.
Unlock
()
self
.
logQueue
[
id
]
.
add
(
logs
...
)
if
queue
:=
self
.
logQueue
[
id
];
queue
!=
nil
{
queue
.
add
(
logs
...
)
}
}
id
=
self
.
filterManager
.
InstallFilter
(
filter
)
self
.
logQueue
[
id
]
=
&
logQueue
{
timeout
:
time
.
Now
()}
return
id
}
...
...
@@ -556,16 +558,18 @@ func (self *XEth) NewTransactionFilter() int {
self
.
transactionMu
.
Lock
()
defer
self
.
transactionMu
.
Unlock
()
var
id
int
filter
:=
core
.
NewFilter
(
self
.
backend
)
id
:=
self
.
filterManager
.
InstallFilter
(
filter
)
self
.
transactionQueue
[
id
]
=
&
hashQueue
{
timeout
:
time
.
Now
()}
filter
.
TransactionCallback
=
func
(
tx
*
types
.
Transaction
)
{
self
.
transactionMu
.
Lock
()
defer
self
.
transactionMu
.
Unlock
()
self
.
transactionQueue
[
id
]
.
add
(
tx
.
Hash
())
if
queue
:=
self
.
transactionQueue
[
id
];
queue
!=
nil
{
queue
.
add
(
tx
.
Hash
())
}
}
id
=
self
.
filterManager
.
InstallFilter
(
filter
)
self
.
transactionQueue
[
id
]
=
&
hashQueue
{
timeout
:
time
.
Now
()}
return
id
}
...
...
@@ -573,16 +577,18 @@ func (self *XEth) NewBlockFilter() int {
self
.
blockMu
.
Lock
()
defer
self
.
blockMu
.
Unlock
()
var
id
int
filter
:=
core
.
NewFilter
(
self
.
backend
)
id
:=
self
.
filterManager
.
InstallFilter
(
filter
)
self
.
blockQueue
[
id
]
=
&
hashQueue
{
timeout
:
time
.
Now
()}
filter
.
BlockCallback
=
func
(
block
*
types
.
Block
,
logs
state
.
Logs
)
{
self
.
blockMu
.
Lock
()
defer
self
.
blockMu
.
Unlock
()
self
.
blockQueue
[
id
]
.
add
(
block
.
Hash
())
if
queue
:=
self
.
blockQueue
[
id
];
queue
!=
nil
{
queue
.
add
(
block
.
Hash
())
}
}
id
=
self
.
filterManager
.
InstallFilter
(
filter
)
self
.
blockQueue
[
id
]
=
&
hashQueue
{
timeout
:
time
.
Now
()}
return
id
}
...
...
@@ -1022,16 +1028,24 @@ func (m callmsg) Value() *big.Int { return m.value }
func
(
m
callmsg
)
Data
()
[]
byte
{
return
m
.
data
}
type
logQueue
struct
{
mu
sync
.
Mutex
logs
state
.
Logs
timeout
time
.
Time
id
int
}
func
(
l
*
logQueue
)
add
(
logs
...*
state
.
Log
)
{
l
.
mu
.
Lock
()
defer
l
.
mu
.
Unlock
()
l
.
logs
=
append
(
l
.
logs
,
logs
...
)
}
func
(
l
*
logQueue
)
get
()
state
.
Logs
{
l
.
mu
.
Lock
()
defer
l
.
mu
.
Unlock
()
l
.
timeout
=
time
.
Now
()
tmp
:=
l
.
logs
l
.
logs
=
nil
...
...
@@ -1039,16 +1053,24 @@ func (l *logQueue) get() state.Logs {
}
type
hashQueue
struct
{
mu
sync
.
Mutex
hashes
[]
common
.
Hash
timeout
time
.
Time
id
int
}
func
(
l
*
hashQueue
)
add
(
hashes
...
common
.
Hash
)
{
l
.
mu
.
Lock
()
defer
l
.
mu
.
Unlock
()
l
.
hashes
=
append
(
l
.
hashes
,
hashes
...
)
}
func
(
l
*
hashQueue
)
get
()
[]
common
.
Hash
{
l
.
mu
.
Lock
()
defer
l
.
mu
.
Unlock
()
l
.
timeout
=
time
.
Now
()
tmp
:=
l
.
hashes
l
.
hashes
=
nil
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment