Enable txindex=1 as default #37

Closed
kodxana wants to merge 211 commits from master into master
2 changed files with 13 additions and 13 deletions
Showing only changes of commit dfb1a6797b - Show all commits

View file

@ -159,7 +159,7 @@ func ExtractWitnessProgramInfo(script []byte) (int, []byte, error) {
"unable to extract version or witness program") "unable to extract version or witness program")
} }
witnessVersion := asSmallInt(pops[0].opcode) witnessVersion := asSmallInt(pops[0].opcode.value)
witnessProgram := pops[1].data witnessProgram := pops[1].data
return witnessVersion, witnessProgram, nil return witnessVersion, witnessProgram, nil
@ -700,12 +700,12 @@ func calcSignatureHash(prevOutScript []parsedOpcode, hashType SigHashType,
// asSmallInt returns the passed opcode, which must be true according to // asSmallInt returns the passed opcode, which must be true according to
// isSmallInt(), as an integer. // isSmallInt(), as an integer.
func asSmallInt(op *opcode) int { func asSmallInt(op byte) int {
if op.value == OP_0 { if op == OP_0 {
return 0 return 0
} }
return int(op.value - (OP_1 - 1)) return int(op - (OP_1 - 1))
} }
// getSigOpCount is the implementation function for counting the number of // getSigOpCount is the implementation function for counting the number of
@ -730,7 +730,7 @@ func getSigOpCount(pops []parsedOpcode, precise bool) int {
if precise && i > 0 && if precise && i > 0 &&
pops[i-1].opcode.value >= OP_1 && pops[i-1].opcode.value >= OP_1 &&
pops[i-1].opcode.value <= OP_16 { pops[i-1].opcode.value <= OP_16 {
nSigs += asSmallInt(pops[i-1].opcode) nSigs += asSmallInt(pops[i-1].opcode.value)
} else { } else {
nSigs += MaxPubKeysPerMultiSig nSigs += MaxPubKeysPerMultiSig
} }

View file

@ -127,7 +127,7 @@ func isMultiSig(pops []parsedOpcode) bool {
// Verify the number of pubkeys specified matches the actual number // Verify the number of pubkeys specified matches the actual number
// of pubkeys provided. // of pubkeys provided.
if l-2-1 != asSmallInt(pops[l-2].opcode) { if l-2-1 != asSmallInt(pops[l-2].opcode.value) {
return false return false
} }
@ -238,7 +238,7 @@ func expectedInputs(pops []parsedOpcode, class ScriptClass) int {
// the original bitcoind bug where OP_CHECKMULTISIG pops an // the original bitcoind bug where OP_CHECKMULTISIG pops an
// additional item from the stack, add an extra expected input // additional item from the stack, add an extra expected input
// for the extra push that is required to compensate. // for the extra push that is required to compensate.
return asSmallInt(pops[0].opcode) + 1 return asSmallInt(pops[0].opcode.value) + 1
case NullDataTy: case NullDataTy:
fallthrough fallthrough
@ -395,8 +395,8 @@ func CalcMultiSigStats(script []byte) (int, int, error) {
return 0, 0, scriptError(ErrNotMultisigScript, str) return 0, 0, scriptError(ErrNotMultisigScript, str)
} }
numSigs := asSmallInt(pops[0].opcode) numSigs := asSmallInt(pops[0].opcode.value)
numPubKeys := asSmallInt(pops[len(pops)-2].opcode) numPubKeys := asSmallInt(pops[len(pops)-2].opcode.value)
return numPubKeys, numSigs, nil return numPubKeys, numSigs, nil
} }
@ -617,8 +617,8 @@ func ExtractPkScriptAddrs(pkScript []byte, chainParams *chaincfg.Params) (Script
// Therefore the number of required signatures is the 1st item // Therefore the number of required signatures is the 1st item
// on the stack and the number of public keys is the 2nd to last // on the stack and the number of public keys is the 2nd to last
// item on the stack. // item on the stack.
requiredSigs = asSmallInt(pops[0].opcode) requiredSigs = asSmallInt(pops[0].opcode.value)
numPubKeys := asSmallInt(pops[len(pops)-2].opcode) numPubKeys := asSmallInt(pops[len(pops)-2].opcode.value)
// Extract the public keys while skipping any that are invalid. // Extract the public keys while skipping any that are invalid.
addrs = make([]btcutil.Address, 0, numPubKeys) addrs = make([]btcutil.Address, 0, numPubKeys)
@ -706,7 +706,7 @@ func ExtractAtomicSwapDataPushes(version uint16, pkScript []byte) (*AtomicSwapDa
} }
pushes.SecretSize = int64(locktime) pushes.SecretSize = int64(locktime)
} else if op := pops[2].opcode; isSmallInt(op.value) { } else if op := pops[2].opcode; isSmallInt(op.value) {
pushes.SecretSize = int64(asSmallInt(op)) pushes.SecretSize = int64(asSmallInt(op.value))
} else { } else {
return nil, nil return nil, nil
} }
@ -717,7 +717,7 @@ func ExtractAtomicSwapDataPushes(version uint16, pkScript []byte) (*AtomicSwapDa
} }
pushes.LockTime = int64(locktime) pushes.LockTime = int64(locktime)
} else if op := pops[11].opcode; isSmallInt(op.value) { } else if op := pops[11].opcode; isSmallInt(op.value) {
pushes.LockTime = int64(asSmallInt(op)) pushes.LockTime = int64(asSmallInt(op.value))
} else { } else {
return nil, nil return nil, nil
} }