Skip to content

Commit

Permalink
all: change blacklist terms
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-b-pegasys authored and i-norden committed Sep 10, 2021
1 parent bd4a2ba commit 597d510
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cmd/puppeth/module_ethstats.go
Expand Up @@ -158,7 +158,7 @@ func checkEthstats(client *sshClient, network string) (*ethstatsInfos, error) {
if port != 80 && port != 443 {
config += fmt.Sprintf(":%d", port)
}
// Retrieve the IP blacklist
// Retrieve the IP banned list
banned := strings.Split(infos.envvars["BANNED"], ",")

// Run a sanity check to see if the port is reachable
Expand Down
10 changes: 5 additions & 5 deletions cmd/puppeth/wizard_ethstats.go
Expand Up @@ -63,20 +63,20 @@ func (w *wizard) deployEthstats() {
fmt.Printf("What should be the secret password for the API? (default = %s)\n", infos.secret)
infos.secret = w.readDefaultString(infos.secret)
}
// Gather any blacklists to ban from reporting
// Gather any banned lists to ban from reporting
if existed {
fmt.Println()
fmt.Printf("Keep existing IP %v blacklist (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) {
// The user might want to clear the entire list, although generally probably not
fmt.Println()
fmt.Printf("Clear out blacklist 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) {
infos.banned = nil
}
// Offer the user to explicitly add/remove certain IP addresses
fmt.Println()
fmt.Println("Which additional IP addresses should be blacklisted?")
fmt.Println("Which additional IP addresses should be in the banned list?")
for {
if ip := w.readIPAddress(); ip != "" {
infos.banned = append(infos.banned, ip)
Expand All @@ -85,7 +85,7 @@ func (w *wizard) deployEthstats() {
break
}
fmt.Println()
fmt.Println("Which IP addresses should not be blacklisted?")
fmt.Println("Which IP addresses should not be in the banned list?")
for {
if ip := w.readIPAddress(); ip != "" {
for i, addr := range infos.banned {
Expand Down
2 changes: 1 addition & 1 deletion consensus/ethash/consensus.go
Expand Up @@ -215,7 +215,7 @@ func (ethash *Ethash) VerifyUncles(chain consensus.ChainReader, block *types.Blo
ancestors[parent] = ancestorHeader
// If the ancestor doesn't have any uncles, we don't have to iterate them
if ancestorHeader.UncleHash != types.EmptyUncleHash {
// Need to add those uncles to the blacklist too
// Need to add those uncles to the banned list too
ancestor := chain.GetBlock(parent, number)
if ancestor == nil {
break
Expand Down
4 changes: 2 additions & 2 deletions core/blockchain.go
Expand Up @@ -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 BadHashes[block.Hash()] {
bc.reportBlock(block, nil, ErrBlacklistedHash)
return it.index, ErrBlacklistedHash
bc.reportBlock(block, nil, ErrBannedHash)
return it.index, ErrBannedHash
}
// 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
Expand Down
4 changes: 2 additions & 2 deletions core/blockchain_test.go
Expand Up @@ -473,8 +473,8 @@ func testBadHashes(t *testing.T, full bool) {

_, err = blockchain.InsertHeaderChain(headers, 1)
}
if !errors.Is(err, ErrBlacklistedHash) {
t.Errorf("error mismatch: have: %v, want: %v", err, ErrBlacklistedHash)
if !errors.Is(err, ErrBannedHash) {
t.Errorf("error mismatch: have: %v, want: %v", err, ErrBannedHash)
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/error.go
Expand Up @@ -26,8 +26,8 @@ var (
// ErrKnownBlock is returned when a block to import is already known locally.
ErrKnownBlock = errors.New("block already known")

// ErrBlacklistedHash is returned if a block to import is on the blacklist.
ErrBlacklistedHash = errors.New("blacklisted hash")
// ErrBannedHash is returned if a block to import is on the banned list.
ErrBannedHash = errors.New("banned hash")

// ErrNoGenesis is returned when there is no Genesis Block.
ErrNoGenesis = errors.New("genesis not found in chain")
Expand Down
4 changes: 2 additions & 2 deletions core/headerchain.go
Expand Up @@ -315,11 +315,11 @@ func (hc *HeaderChain) ValidateHeaderChain(chain []*types.Header, checkFreq int)
}
// If the header is a banned one, straight out abort
if BadHashes[chain[i].ParentHash] {
return i - 1, ErrBlacklistedHash
return i - 1, ErrBannedHash
}
// If it's the last header in the cunk, we need to check it too
if i == len(chain)-1 && BadHashes[chain[i].Hash()] {
return i, ErrBlacklistedHash
return i, ErrBannedHash
}
}

Expand Down
4 changes: 2 additions & 2 deletions light/lightchain_test.go
Expand Up @@ -322,8 +322,8 @@ func TestBadHeaderHashes(t *testing.T) {
var err error
headers := makeHeaderChainWithDiff(bc.genesisBlock, []int{1, 2, 4}, 10)
core.BadHashes[headers[2].Hash()] = true
if _, err = bc.InsertHeaderChain(headers, 1); !errors.Is(err, core.ErrBlacklistedHash) {
t.Errorf("error mismatch: have: %v, want %v", err, core.ErrBlacklistedHash)
if _, err = bc.InsertHeaderChain(headers, 1); !errors.Is(err, core.ErrBannedHash) {
t.Errorf("error mismatch: have: %v, want %v", err, core.ErrBannedHash)
}
}

Expand Down

0 comments on commit 597d510

Please sign in to comment.