mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-06 14:16:43 +00:00
gofmt
This commit is contained in:
parent
8fe24958bb
commit
53ba8fb834
12
script.go
12
script.go
@ -718,7 +718,7 @@ func (s *Script) SetAltStack(data [][]byte) {
|
||||
|
||||
// GetSigOpCount provides a quick count of the number of signature operations
|
||||
// in a script. a CHECKSIG operations counts for 1, and a CHECK_MULTISIG for 20.
|
||||
func GetSigOpCount(script [] byte) (int, error) {
|
||||
func GetSigOpCount(script []byte) (int, error) {
|
||||
pops, err := parseScript(script)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@ -751,7 +751,7 @@ func GetPreciseSigOpCount(scriptSig, scriptPubKey []byte, bip16 bool) (int, erro
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
shScript := sigPops[len(sigPops) - 1].data
|
||||
shScript := sigPops[len(sigPops)-1].data
|
||||
// Means that sigPops is jus OP_1 - OP_16, no sigops there.
|
||||
if shScript == nil {
|
||||
return 0, nil
|
||||
@ -774,19 +774,19 @@ func getSigOpCount(pops []parsedOpcode, precise bool) int {
|
||||
for i, pop := range pops {
|
||||
switch pop.opcode.value {
|
||||
case OP_CHECKSIG:
|
||||
fallthrough;
|
||||
fallthrough
|
||||
case OP_CHECKSIGVERIFY:
|
||||
nSigs++
|
||||
case OP_CHECK_MULTISIG:
|
||||
fallthrough;
|
||||
fallthrough
|
||||
case OP_CHECKMULTISIGVERIFY:
|
||||
// If we are being precise then look for familiar
|
||||
// patterns for multisig, for now all we recognise is
|
||||
// OP_1 - OP_16 to signify the number of pubkeys.
|
||||
// Otherwise, we use the max of 20.
|
||||
if precise && i > 0 &&
|
||||
pops[i - 1].opcode.value >= OP_1 &&
|
||||
pops[i - 1].opcode.value <= OP_16 {
|
||||
pops[i-1].opcode.value >= OP_1 &&
|
||||
pops[i-1].opcode.value <= OP_16 {
|
||||
nSigs += int(pops[i-1].opcode.value -
|
||||
(OP_1 - 1))
|
||||
} else {
|
||||
|
@ -1302,8 +1302,8 @@ func TestBadPC(t *testing.T) {
|
||||
}
|
||||
pcTests := []pcTest{
|
||||
pcTest{
|
||||
script:2,
|
||||
off:0,
|
||||
script: 2,
|
||||
off: 0,
|
||||
},
|
||||
pcTest{
|
||||
script: 0,
|
||||
@ -1419,7 +1419,7 @@ func TestCheckErrorCondition(t *testing.T) {
|
||||
t.Errorf("failed to create script: %v", err)
|
||||
}
|
||||
|
||||
for i := 0; i < len(pkScript) - 1; i++ {
|
||||
for i := 0; i < len(pkScript)-1; i++ {
|
||||
done, err := engine.Step()
|
||||
if err != nil {
|
||||
t.Errorf("failed to step %dth time: %v", i, err)
|
||||
@ -1452,4 +1452,3 @@ func TestCheckErrorCondition(t *testing.T) {
|
||||
t.Errorf("unexpected error %v on final check", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ var stackTests = []stackTest{
|
||||
return nil
|
||||
},
|
||||
nil,
|
||||
[][]byte{{0x80, 0x00 }},
|
||||
[][]byte{{0x80, 0x00}},
|
||||
},
|
||||
{
|
||||
"dup",
|
||||
|
Loading…
x
Reference in New Issue
Block a user