mirror of
https://github.com/FlipsideCrypto/dcrd.git
synced 2026-02-06 10:56:47 +00:00
txscript; Use const for sighashall optimization.
This breaks the dependency on chaincfg.SigHashOptimization which is no longer available in v2 of the chaincfg module. The constant is set to false to ensure the same semantics are kept and an additional comment has been added regarding the status.
This commit is contained in:
parent
7da223fd98
commit
ad0d98ce75
@ -16,7 +16,6 @@ import (
|
||||
|
||||
"golang.org/x/crypto/ripemd160"
|
||||
|
||||
"github.com/decred/dcrd/chaincfg"
|
||||
"github.com/decred/dcrd/chaincfg/chainhash"
|
||||
"github.com/decred/dcrd/dcrec"
|
||||
"github.com/decred/dcrd/dcrec/edwards"
|
||||
@ -25,7 +24,12 @@ import (
|
||||
"github.com/decred/dcrd/wire"
|
||||
)
|
||||
|
||||
var optimizeSigVerification = chaincfg.SigHashOptimization
|
||||
// optimizeSigVerification is an optimization for verification of transactions
|
||||
// that contain scripts with CHECKSIG operations with a hash type of SigHashAll.
|
||||
//
|
||||
// WARNING: This has not been properly vetted or tested, so it needs significant
|
||||
// review to ensure it does not break consensus before being enabled.
|
||||
const optimizeSigVerification = false
|
||||
|
||||
// An opcode defines the information related to a txscript opcode. opfunc, if
|
||||
// present, is the function to call to perform the opcode on the script. The
|
||||
|
||||
@ -10,7 +10,6 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"github.com/decred/dcrd/chaincfg"
|
||||
"github.com/decred/dcrd/chaincfg/chainhash"
|
||||
"github.com/decred/dcrd/wire"
|
||||
)
|
||||
@ -299,7 +298,7 @@ func calcSignatureHash(signScript []byte, hashType SigHashType, tx *wire.MsgTx,
|
||||
// can be reused because only the witness data has been modified, so
|
||||
// the wasteful extra O(N^2) hash can be avoided.
|
||||
var prefixHash chainhash.Hash
|
||||
if chaincfg.SigHashOptimization && cachedPrefix != nil &&
|
||||
if optimizeSigVerification && cachedPrefix != nil &&
|
||||
hashType&sigHashMask == SigHashAll &&
|
||||
hashType&SigHashAnyOneCanPay == 0 {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user