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
523866c2
Unverified
Commit
523866c2
authored
Jul 29, 2021
by
baptiste-b-pegasys
Committed by
GitHub
Jul 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: change blacklist terms
parent
56e9001a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
17 deletions
+17
-17
module_ethstats.go
cmd/puppeth/module_ethstats.go
+1
-1
wizard_ethstats.go
cmd/puppeth/wizard_ethstats.go
+5
-5
consensus.go
consensus/ethash/consensus.go
+1
-1
blockchain.go
core/blockchain.go
+2
-2
blockchain_test.go
core/blockchain_test.go
+2
-2
error.go
core/error.go
+2
-2
headerchain.go
core/headerchain.go
+2
-2
lightchain_test.go
light/lightchain_test.go
+2
-2
No files found.
cmd/puppeth/module_ethstats.go
View file @
523866c2
...
@@ -158,7 +158,7 @@ func checkEthstats(client *sshClient, network string) (*ethstatsInfos, error) {
...
@@ -158,7 +158,7 @@ func checkEthstats(client *sshClient, network string) (*ethstatsInfos, error) {
if
port
!=
80
&&
port
!=
443
{
if
port
!=
80
&&
port
!=
443
{
config
+=
fmt
.
Sprintf
(
":%d"
,
port
)
config
+=
fmt
.
Sprintf
(
":%d"
,
port
)
}
}
// Retrieve the IP b
lack
list
// Retrieve the IP b
anned
list
banned
:=
strings
.
Split
(
infos
.
envvars
[
"BANNED"
],
","
)
banned
:=
strings
.
Split
(
infos
.
envvars
[
"BANNED"
],
","
)
// Run a sanity check to see if the port is reachable
// Run a sanity check to see if the port is reachable
...
...
cmd/puppeth/wizard_ethstats.go
View file @
523866c2
...
@@ -63,20 +63,20 @@ func (w *wizard) deployEthstats() {
...
@@ -63,20 +63,20 @@ func (w *wizard) deployEthstats() {
fmt
.
Printf
(
"What should be the secret password for the API? (default = %s)
\n
"
,
infos
.
secret
)
fmt
.
Printf
(
"What should be the secret password for the API? (default = %s)
\n
"
,
infos
.
secret
)
infos
.
secret
=
w
.
readDefaultString
(
infos
.
secret
)
infos
.
secret
=
w
.
readDefaultString
(
infos
.
secret
)
}
}
// Gather any b
lack
lists to ban from reporting
// Gather any b
anned
lists to ban from reporting
if
existed
{
if
existed
{
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Printf
(
"Keep existing IP %v
black
list (y/n)? (default = yes)
\n
"
,
infos
.
banned
)
fmt
.
Printf
(
"Keep existing IP %v
in the banned
list (y/n)? (default = yes)
\n
"
,
infos
.
banned
)
if
!
w
.
readDefaultYesNo
(
true
)
{
if
!
w
.
readDefaultYesNo
(
true
)
{
// The user might want to clear the entire list, although generally probably not
// The user might want to clear the entire list, although generally probably not
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Printf
(
"Clear out
black
list and start over (y/n)? (default = no)
\n
"
)
fmt
.
Printf
(
"Clear out
the banned
list and start over (y/n)? (default = no)
\n
"
)
if
w
.
readDefaultYesNo
(
false
)
{
if
w
.
readDefaultYesNo
(
false
)
{
infos
.
banned
=
nil
infos
.
banned
=
nil
}
}
// Offer the user to explicitly add/remove certain IP addresses
// Offer the user to explicitly add/remove certain IP addresses
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"Which additional IP addresses should be
blacklisted
?"
)
fmt
.
Println
(
"Which additional IP addresses should be
in the banned list
?"
)
for
{
for
{
if
ip
:=
w
.
readIPAddress
();
ip
!=
""
{
if
ip
:=
w
.
readIPAddress
();
ip
!=
""
{
infos
.
banned
=
append
(
infos
.
banned
,
ip
)
infos
.
banned
=
append
(
infos
.
banned
,
ip
)
...
@@ -85,7 +85,7 @@ func (w *wizard) deployEthstats() {
...
@@ -85,7 +85,7 @@ func (w *wizard) deployEthstats() {
break
break
}
}
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"Which IP addresses should not be
blacklisted
?"
)
fmt
.
Println
(
"Which IP addresses should not be
in the banned list
?"
)
for
{
for
{
if
ip
:=
w
.
readIPAddress
();
ip
!=
""
{
if
ip
:=
w
.
readIPAddress
();
ip
!=
""
{
for
i
,
addr
:=
range
infos
.
banned
{
for
i
,
addr
:=
range
infos
.
banned
{
...
...
consensus/ethash/consensus.go
View file @
523866c2
...
@@ -215,7 +215,7 @@ func (ethash *Ethash) VerifyUncles(chain consensus.ChainReader, block *types.Blo
...
@@ -215,7 +215,7 @@ func (ethash *Ethash) VerifyUncles(chain consensus.ChainReader, block *types.Blo
ancestors
[
parent
]
=
ancestorHeader
ancestors
[
parent
]
=
ancestorHeader
// If the ancestor doesn't have any uncles, we don't have to iterate them
// If the ancestor doesn't have any uncles, we don't have to iterate them
if
ancestorHeader
.
UncleHash
!=
types
.
EmptyUncleHash
{
if
ancestorHeader
.
UncleHash
!=
types
.
EmptyUncleHash
{
// Need to add those uncles to the b
lack
list too
// Need to add those uncles to the b
anned
list too
ancestor
:=
chain
.
GetBlock
(
parent
,
number
)
ancestor
:=
chain
.
GetBlock
(
parent
,
number
)
if
ancestor
==
nil
{
if
ancestor
==
nil
{
break
break
...
...
core/blockchain.go
View file @
523866c2
...
@@ -1785,8 +1785,8 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, er
...
@@ -1785,8 +1785,8 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, er
}
}
// If the header is a banned one, straight out abort
// If the header is a banned one, straight out abort
if
BadHashes
[
block
.
Hash
()]
{
if
BadHashes
[
block
.
Hash
()]
{
bc
.
reportBlock
(
block
,
nil
,
ErrB
lacklist
edHash
)
bc
.
reportBlock
(
block
,
nil
,
ErrB
ann
edHash
)
return
it
.
index
,
ErrB
lacklist
edHash
return
it
.
index
,
ErrB
ann
edHash
}
}
// If the block is known (in the middle of the chain), it's a special case for
// If the block is known (in the middle of the chain), it's a special case for
// Clique blocks where they can share state among each other, so importing an
// Clique blocks where they can share state among each other, so importing an
...
...
core/blockchain_test.go
View file @
523866c2
...
@@ -473,8 +473,8 @@ func testBadHashes(t *testing.T, full bool) {
...
@@ -473,8 +473,8 @@ func testBadHashes(t *testing.T, full bool) {
_
,
err
=
blockchain
.
InsertHeaderChain
(
headers
,
1
)
_
,
err
=
blockchain
.
InsertHeaderChain
(
headers
,
1
)
}
}
if
!
errors
.
Is
(
err
,
ErrB
lacklist
edHash
)
{
if
!
errors
.
Is
(
err
,
ErrB
ann
edHash
)
{
t
.
Errorf
(
"error mismatch: have: %v, want: %v"
,
err
,
ErrB
lacklist
edHash
)
t
.
Errorf
(
"error mismatch: have: %v, want: %v"
,
err
,
ErrB
ann
edHash
)
}
}
}
}
...
...
core/error.go
View file @
523866c2
...
@@ -26,8 +26,8 @@ var (
...
@@ -26,8 +26,8 @@ var (
// ErrKnownBlock is returned when a block to import is already known locally.
// ErrKnownBlock is returned when a block to import is already known locally.
ErrKnownBlock
=
errors
.
New
(
"block already known"
)
ErrKnownBlock
=
errors
.
New
(
"block already known"
)
// ErrB
lacklistedHash is returned if a block to import is on the black
list.
// ErrB
annedHash is returned if a block to import is on the banned
list.
ErrB
lacklistedHash
=
errors
.
New
(
"blacklist
ed hash"
)
ErrB
annedHash
=
errors
.
New
(
"bann
ed hash"
)
// ErrNoGenesis is returned when there is no Genesis Block.
// ErrNoGenesis is returned when there is no Genesis Block.
ErrNoGenesis
=
errors
.
New
(
"genesis not found in chain"
)
ErrNoGenesis
=
errors
.
New
(
"genesis not found in chain"
)
...
...
core/headerchain.go
View file @
523866c2
...
@@ -315,11 +315,11 @@ func (hc *HeaderChain) ValidateHeaderChain(chain []*types.Header, checkFreq int)
...
@@ -315,11 +315,11 @@ func (hc *HeaderChain) ValidateHeaderChain(chain []*types.Header, checkFreq int)
}
}
// If the header is a banned one, straight out abort
// If the header is a banned one, straight out abort
if
BadHashes
[
chain
[
i
]
.
ParentHash
]
{
if
BadHashes
[
chain
[
i
]
.
ParentHash
]
{
return
i
-
1
,
ErrB
lacklist
edHash
return
i
-
1
,
ErrB
ann
edHash
}
}
// If it's the last header in the cunk, we need to check it too
// If it's the last header in the cunk, we need to check it too
if
i
==
len
(
chain
)
-
1
&&
BadHashes
[
chain
[
i
]
.
Hash
()]
{
if
i
==
len
(
chain
)
-
1
&&
BadHashes
[
chain
[
i
]
.
Hash
()]
{
return
i
,
ErrB
lacklist
edHash
return
i
,
ErrB
ann
edHash
}
}
}
}
...
...
light/lightchain_test.go
View file @
523866c2
...
@@ -322,8 +322,8 @@ func TestBadHeaderHashes(t *testing.T) {
...
@@ -322,8 +322,8 @@ func TestBadHeaderHashes(t *testing.T) {
var
err
error
var
err
error
headers
:=
makeHeaderChainWithDiff
(
bc
.
genesisBlock
,
[]
int
{
1
,
2
,
4
},
10
)
headers
:=
makeHeaderChainWithDiff
(
bc
.
genesisBlock
,
[]
int
{
1
,
2
,
4
},
10
)
core
.
BadHashes
[
headers
[
2
]
.
Hash
()]
=
true
core
.
BadHashes
[
headers
[
2
]
.
Hash
()]
=
true
if
_
,
err
=
bc
.
InsertHeaderChain
(
headers
,
1
);
!
errors
.
Is
(
err
,
core
.
ErrB
lacklist
edHash
)
{
if
_
,
err
=
bc
.
InsertHeaderChain
(
headers
,
1
);
!
errors
.
Is
(
err
,
core
.
ErrB
ann
edHash
)
{
t
.
Errorf
(
"error mismatch: have: %v, want %v"
,
err
,
core
.
ErrB
lacklist
edHash
)
t
.
Errorf
(
"error mismatch: have: %v, want %v"
,
err
,
core
.
ErrB
ann
edHash
)
}
}
}
}
...
...
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