Files
zeekayandHanzo Dev 67da44a1f3 Depend on the renamed utility package
github.com/luxfi/utils is now github.com/luxfi/util. Import paths and the
module requirement follow the rename; the old module stays as an indirect
requirement that published dependencies still pull in.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-06 04:15:48 -07:00

45 lines
1.0 KiB
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package secp256k1fx
import (
"errors"
"github.com/luxfi/math"
"github.com/luxfi/util"
)
const (
CostPerSignature uint64 = 1000
)
var (
ErrNilInput = errors.New("nil input")
ErrInputIndicesNotSortedUnique = errors.New("address indices not sorted and unique")
)
type Input struct {
// This input consumes an output, which has an owner list.
// This input will be spent with a list of signatures.
// SignatureList[i] is the signature of OwnerList[i]
SigIndices []uint32 `serialize:"true" json:"signatureIndices"`
}
func (in *Input) Cost() (uint64, error) {
numSigs := uint64(len(in.SigIndices))
return math.Mul(numSigs, CostPerSignature)
}
// Verify this input is syntactically valid
func (in *Input) Verify() error {
switch {
case in == nil:
return ErrNilInput
case !utils.IsSortedAndUniqueOrdered(in.SigIndices):
return ErrInputIndicesNotSortedUnique
default:
return nil
}
}