all: change blacklist terms

This commit is contained in:
baptiste-b-pegasys 2021-07-29 10:17:40 +02:00 committed by GitHub
parent 56e9001a1a
commit 523866c2cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 17 deletions

View File

@ -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 blacklist // Retrieve the IP banned 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

View File

@ -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 blacklists to ban from reporting // Gather any banned lists to ban from reporting
if existed { if existed {
fmt.Println() 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) { 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 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) { 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() {
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 {

View File

@ -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 blacklist too // Need to add those uncles to the banned list too
ancestor := chain.GetBlock(parent, number) ancestor := chain.GetBlock(parent, number)
if ancestor == nil { if ancestor == nil {
break break

View File

@ -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, ErrBlacklistedHash) bc.reportBlock(block, nil, ErrBannedHash)
return it.index, ErrBlacklistedHash return it.index, ErrBannedHash
} }
// 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

View File

@ -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, ErrBlacklistedHash) { if !errors.Is(err, ErrBannedHash) {
t.Errorf("error mismatch: have: %v, want: %v", err, ErrBlacklistedHash) t.Errorf("error mismatch: have: %v, want: %v", err, ErrBannedHash)
} }
} }

View File

@ -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")
// ErrBlacklistedHash is returned if a block to import is on the blacklist. // ErrBannedHash is returned if a block to import is on the banned list.
ErrBlacklistedHash = errors.New("blacklisted hash") ErrBannedHash = errors.New("banned 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")

View File

@ -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, ErrBlacklistedHash return i - 1, ErrBannedHash
} }
// 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, ErrBlacklistedHash return i, ErrBannedHash
} }
} }

View File

@ -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.ErrBlacklistedHash) { if _, err = bc.InsertHeaderChain(headers, 1); !errors.Is(err, core.ErrBannedHash) {
t.Errorf("error mismatch: have: %v, want %v", err, core.ErrBlacklistedHash) t.Errorf("error mismatch: have: %v, want %v", err, core.ErrBannedHash)
} }
} }