From 523866c2ccbfd75ee88b309167cdba7311ba9695 Mon Sep 17 00:00:00 2001 From: baptiste-b-pegasys <85155432+baptiste-b-pegasys@users.noreply.github.com> Date: Thu, 29 Jul 2021 10:17:40 +0200 Subject: [PATCH] all: change blacklist terms --- cmd/puppeth/module_ethstats.go | 2 +- cmd/puppeth/wizard_ethstats.go | 10 +++++----- consensus/ethash/consensus.go | 2 +- core/blockchain.go | 4 ++-- core/blockchain_test.go | 4 ++-- core/error.go | 4 ++-- core/headerchain.go | 4 ++-- light/lightchain_test.go | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd/puppeth/module_ethstats.go b/cmd/puppeth/module_ethstats.go index 58ecb83951..abed4db5fc 100644 --- a/cmd/puppeth/module_ethstats.go +++ b/cmd/puppeth/module_ethstats.go @@ -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 diff --git a/cmd/puppeth/wizard_ethstats.go b/cmd/puppeth/wizard_ethstats.go index 58ff3efbe9..95cab9da46 100644 --- a/cmd/puppeth/wizard_ethstats.go +++ b/cmd/puppeth/wizard_ethstats.go @@ -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) @@ -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 { diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index 9b9657e190..5743387f6c 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -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 diff --git a/core/blockchain.go b/core/blockchain.go index 18e126657c..48a23da79b 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -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 diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 7fb4c6f695..4e5df633b7 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -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) } } diff --git a/core/error.go b/core/error.go index a5a1230099..bcbce09ba4 100644 --- a/core/error.go +++ b/core/error.go @@ -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") diff --git a/core/headerchain.go b/core/headerchain.go index 07307c710c..7ef7dd43f7 100644 --- a/core/headerchain.go +++ b/core/headerchain.go @@ -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 } } diff --git a/light/lightchain_test.go b/light/lightchain_test.go index 2aed08d74e..af36ebd96a 100644 --- a/light/lightchain_test.go +++ b/light/lightchain_test.go @@ -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) } }