github.com/decred/dcrlnd@v0.7.6/internal/psbt/partialsig.go (about)

     1  package psbt
     2  
     3  import (
     4  	"bytes"
     5  )
     6  
     7  // PartialSig encapsulate a (BTC public key, ECDSA signature)
     8  // pair, note that the fields are stored as byte slices, not
     9  // btcec.PublicKey or btcec.Signature (because manipulations will
    10  // be with the former not the latter, here); compliance with consensus
    11  // serialization is enforced with .checkValid()
    12  type PartialSig struct {
    13  	PubKey    []byte
    14  	Signature []byte
    15  }
    16  
    17  // PartialSigSorter implements sort.Interface for PartialSig.
    18  type PartialSigSorter []*PartialSig
    19  
    20  func (s PartialSigSorter) Len() int { return len(s) }
    21  
    22  func (s PartialSigSorter) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
    23  
    24  func (s PartialSigSorter) Less(i, j int) bool {
    25  	return bytes.Compare(s[i].PubKey, s[j].PubKey) < 0
    26  }