Files
utxo/secp256k1fx/input.go
zeekay 8f7179ae0d refactor: move fx packages to root
Drop redundant fx/ directory since packages already have fx suffix:
- github.com/luxfi/utxo/fx/secp256k1fx → github.com/luxfi/utxo/secp256k1fx
- github.com/luxfi/utxo/fx/nftfx → github.com/luxfi/utxo/nftfx
- github.com/luxfi/utxo/fx/propertyfx → github.com/luxfi/utxo/propertyfx

BREAKING CHANGE: Import paths changed
2026-01-10 12:54:02 -08: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/utils"
)
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.Mul64(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
}
}