Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockchain: Remove unused disable verify method. #2999

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions internal/blockchain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,6 @@ type BlockChain struct {
// fields in this struct below this point.
chainLock sync.RWMutex

// This field is a configuration parameter that can be toggled at runtime.
// It is protected by the chain lock.
noVerify bool

// These fields are related to the memory block index. They both have
// their own locks, however they are often also protected by the chain
// lock to help prevent logic races when blocks are being processed.
Expand Down Expand Up @@ -369,19 +365,6 @@ func (b *BlockChain) GetVoteInfo(hash *chainhash.Hash, version uint32) (*VoteInf
return &vi, nil
}

// DisableVerify provides a mechanism to disable transaction script validation
// which you DO NOT want to do in production as it could allow double spends
// and other undesirable things. It is provided only for debug purposes since
// script validation is extremely intensive and when debugging it is sometimes
// nice to quickly get the chain.
//
// This function is safe for concurrent access.
func (b *BlockChain) DisableVerify(disable bool) {
b.chainLock.Lock()
b.noVerify = disable
b.chainLock.Unlock()
}

// HaveHeader returns whether or not the chain instance has the block header
// represented by the passed hash. Note that this will return true for both the
// main chain and any side chains.
Expand Down
5 changes: 1 addition & 4 deletions internal/blockchain/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3839,10 +3839,7 @@ func (b *BlockChain) checkConnectBlock(node *blockNode, block, parent *dcrutil.B
// root hash and any changes will therefore be detected by the assumed valid
// node). This is a huge optimization because running the scripts is the
// most time consuming portion of block handling.
runScripts := !b.noVerify
if b.bulkImportMode || b.isAssumeValidAncestor(node) {
runScripts = false
}
runScripts := !b.bulkImportMode && !b.isAssumeValidAncestor(node)
var scriptFlags txscript.ScriptFlags
if runScripts {
var err error
Expand Down