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
1ae80aaf
Commit
1ae80aaf
authored
Jul 01, 2015
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: fix #1371, double lock during block/txn known set limitation
parent
60454da6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
peer.go
eth/peer.go
+4
-10
No files found.
eth/peer.go
View file @
1ae80aaf
...
...
@@ -94,11 +94,8 @@ func (p *peer) SetTd(td *big.Int) {
// never be propagated to this particular peer.
func
(
p
*
peer
)
MarkBlock
(
hash
common
.
Hash
)
{
// If we reached the memory allowance, drop a previously known block hash
if
p
.
knownBlocks
.
Size
()
>=
maxKnownBlocks
{
p
.
knownBlocks
.
Each
(
func
(
item
interface
{})
bool
{
p
.
knownBlocks
.
Remove
(
item
)
return
p
.
knownBlocks
.
Size
()
>=
maxKnownBlocks
})
for
p
.
knownBlocks
.
Size
()
>=
maxKnownBlocks
{
p
.
knownBlocks
.
Pop
()
}
p
.
knownBlocks
.
Add
(
hash
)
}
...
...
@@ -107,11 +104,8 @@ func (p *peer) MarkBlock(hash common.Hash) {
// will never be propagated to this particular peer.
func
(
p
*
peer
)
MarkTransaction
(
hash
common
.
Hash
)
{
// If we reached the memory allowance, drop a previously known transaction hash
if
p
.
knownTxs
.
Size
()
>=
maxKnownTxs
{
p
.
knownTxs
.
Each
(
func
(
item
interface
{})
bool
{
p
.
knownTxs
.
Remove
(
item
)
return
p
.
knownTxs
.
Size
()
>=
maxKnownTxs
})
for
p
.
knownTxs
.
Size
()
>=
maxKnownTxs
{
p
.
knownTxs
.
Pop
()
}
p
.
knownTxs
.
Add
(
hash
)
}
...
...
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