feat(lns): add is-reserved aliases
This commit is contained in:
parent
d73adb2543
commit
ac5cbc796a
3 changed files with 40 additions and 0 deletions
24
lns.go
24
lns.go
|
|
@ -969,6 +969,13 @@ func IsReserved(nameHash primitives.Hash, height uint32, rules NameRules) bool {
|
|||
return covenant.IsReserved(nameHash, height, rules)
|
||||
}
|
||||
|
||||
// GetIsReserved is an alias for IsReserved.
|
||||
//
|
||||
// ok := lns.GetIsReserved(nameHash, height, rules)
|
||||
func GetIsReserved(nameHash primitives.Hash, height uint32, rules NameRules) bool {
|
||||
return IsReserved(nameHash, height, rules)
|
||||
}
|
||||
|
||||
// IsLockedUp reports whether a name hash is locked at the given height.
|
||||
//
|
||||
// ok := lns.IsLockedUp(nameHash, height, rules)
|
||||
|
|
@ -976,6 +983,13 @@ func IsLockedUp(nameHash primitives.Hash, height uint32, rules NameRules) bool {
|
|||
return covenant.IsLockedUp(nameHash, height, rules)
|
||||
}
|
||||
|
||||
// GetIsLockedUp is an alias for IsLockedUp.
|
||||
//
|
||||
// ok := lns.GetIsLockedUp(nameHash, height, rules)
|
||||
func GetIsLockedUp(nameHash primitives.Hash, height uint32, rules NameRules) bool {
|
||||
return IsLockedUp(nameHash, height, rules)
|
||||
}
|
||||
|
||||
// GrindName searches for an available name that satisfies the current rollout
|
||||
// and reservation rules.
|
||||
//
|
||||
|
|
@ -1546,11 +1560,21 @@ func (s *Service) IsReserved(nameHash primitives.Hash, height uint32, rules Name
|
|||
return covenant.IsReserved(nameHash, height, rules)
|
||||
}
|
||||
|
||||
// GetIsReserved is an alias for IsReserved.
|
||||
func (s *Service) GetIsReserved(nameHash primitives.Hash, height uint32, rules NameRules) bool {
|
||||
return s.IsReserved(nameHash, height, rules)
|
||||
}
|
||||
|
||||
// IsLockedUp reports whether a name hash is locked at the given height.
|
||||
func (s *Service) IsLockedUp(nameHash primitives.Hash, height uint32, rules NameRules) bool {
|
||||
return covenant.IsLockedUp(nameHash, height, rules)
|
||||
}
|
||||
|
||||
// GetIsLockedUp is an alias for IsLockedUp.
|
||||
func (s *Service) GetIsLockedUp(nameHash primitives.Hash, height uint32, rules NameRules) bool {
|
||||
return s.IsLockedUp(nameHash, height, rules)
|
||||
}
|
||||
|
||||
// GrindName searches for an available name that satisfies the current rollout
|
||||
// and reservation rules.
|
||||
func (s *Service) GrindName(size int, height uint32, rules NameRules) (string, error) {
|
||||
|
|
|
|||
|
|
@ -703,6 +703,10 @@ func TestPackageRolloutHelpers(t *testing.T) {
|
|||
t.Fatal("IsReserved should report reserved hashes before the claim period")
|
||||
}
|
||||
|
||||
if !GetIsReserved(hash, 99, rules) {
|
||||
t.Fatal("GetIsReserved should alias IsReserved")
|
||||
}
|
||||
|
||||
rootHash, err := covenant.HashString("nec")
|
||||
if err != nil {
|
||||
t.Fatalf("HashString returned error: %v", err)
|
||||
|
|
@ -711,6 +715,10 @@ func TestPackageRolloutHelpers(t *testing.T) {
|
|||
if !IsLockedUp(rootHash, 100, rules) {
|
||||
t.Fatal("IsLockedUp should keep root hashes locked after the claim period")
|
||||
}
|
||||
|
||||
if !GetIsLockedUp(rootHash, 100, rules) {
|
||||
t.Fatal("GetIsLockedUp should alias IsLockedUp")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPackageCatalogLookupNormalization(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -721,6 +721,10 @@ func TestServiceRolloutHelpers(t *testing.T) {
|
|||
t.Fatal("IsReserved should report reserved hashes before the claim period")
|
||||
}
|
||||
|
||||
if !svc.GetIsReserved(reservedHash, 99, rules) {
|
||||
t.Fatal("GetIsReserved should alias IsReserved")
|
||||
}
|
||||
|
||||
rootHash, err := covenant.HashString("nec")
|
||||
if err != nil {
|
||||
t.Fatalf("HashString returned error: %v", err)
|
||||
|
|
@ -729,6 +733,10 @@ func TestServiceRolloutHelpers(t *testing.T) {
|
|||
if !svc.IsLockedUp(rootHash, 100, rules) {
|
||||
t.Fatal("IsLockedUp should keep root hashes locked after the claim period")
|
||||
}
|
||||
|
||||
if !svc.GetIsLockedUp(rootHash, 100, rules) {
|
||||
t.Fatal("GetIsLockedUp should alias IsLockedUp")
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceGrindAndCountHelpers(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue