github.com/decred/dcrlnd@v0.7.6/record/custom_records.go (about)

     1  package record
     2  
     3  import "fmt"
     4  
     5  const (
     6  	// CustomTypeStart is the start of the custom tlv type range as defined
     7  	// in BOLT 01.
     8  	CustomTypeStart = 65536
     9  )
    10  
    11  // CustomSet stores a set of custom key/value pairs.
    12  type CustomSet map[uint64][]byte
    13  
    14  // Validate checks that all custom records are in the custom type range.
    15  func (c CustomSet) Validate() error {
    16  	for key := range c {
    17  		if key < CustomTypeStart {
    18  			return fmt.Errorf("no custom records with types "+
    19  				"below %v allowed", CustomTypeStart)
    20  		}
    21  	}
    22  
    23  	return nil
    24  }