feat(covenant): add has-hash alias mirrors
This commit is contained in:
parent
8ae69ea23c
commit
dab6e84850
4 changed files with 52 additions and 0 deletions
|
|
@ -156,6 +156,13 @@ func HasLockedHash(hash primitives.Hash) bool {
|
|||
return DefaultLockedCatalog().Has(hash)
|
||||
}
|
||||
|
||||
// GetHasLockedHash is an alias for HasLockedHash.
|
||||
//
|
||||
// ok := covenant.GetHasLockedHash(hash)
|
||||
func GetHasLockedHash(hash primitives.Hash) bool {
|
||||
return HasLockedHash(hash)
|
||||
}
|
||||
|
||||
// GetLockedByHash is an alias for GetLockedHash.
|
||||
//
|
||||
// item, ok := covenant.GetLockedByHash(hash)
|
||||
|
|
@ -170,6 +177,13 @@ func HasLockedByHash(hash primitives.Hash) bool {
|
|||
return HasLockedHash(hash)
|
||||
}
|
||||
|
||||
// GetHasLockedByHash is an alias for HasLockedByHash.
|
||||
//
|
||||
// ok := covenant.GetHasLockedByHash(hash)
|
||||
func GetHasLockedByHash(hash primitives.Hash) bool {
|
||||
return HasLockedByHash(hash)
|
||||
}
|
||||
|
||||
// DefaultLockedCatalog returns the lazily loaded locked-name catalog.
|
||||
//
|
||||
// catalog := covenant.DefaultLockedCatalog()
|
||||
|
|
|
|||
|
|
@ -153,13 +153,25 @@ func TestLockedLookupHasByHashAlias(t *testing.T) {
|
|||
t.Fatal("HasLockedHash should report the locked reference entry")
|
||||
}
|
||||
|
||||
if !GetHasLockedHash(hash) {
|
||||
t.Fatal("GetHasLockedHash should alias HasLockedHash")
|
||||
}
|
||||
|
||||
if !HasLockedByHash(hash) {
|
||||
t.Fatal("HasLockedByHash should report the locked reference entry")
|
||||
}
|
||||
|
||||
if !GetHasLockedByHash(hash) {
|
||||
t.Fatal("GetHasLockedByHash should alias HasLockedByHash")
|
||||
}
|
||||
|
||||
if HasLockedHash(primitives.Hash{}) {
|
||||
t.Fatal("HasLockedHash should return false for unknown hashes")
|
||||
}
|
||||
|
||||
if GetHasLockedHash(primitives.Hash{}) {
|
||||
t.Fatal("GetHasLockedHash should return false for unknown hashes")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLockedLookupRejectsUnknownNames(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -172,6 +172,13 @@ func HasReservedHash(hash primitives.Hash) bool {
|
|||
return DefaultReservedCatalog().Has(hash)
|
||||
}
|
||||
|
||||
// GetHasReservedHash is an alias for HasReservedHash.
|
||||
//
|
||||
// ok := covenant.GetHasReservedHash(hash)
|
||||
func GetHasReservedHash(hash primitives.Hash) bool {
|
||||
return HasReservedHash(hash)
|
||||
}
|
||||
|
||||
// GetReservedByHash is an alias for GetReservedHash.
|
||||
//
|
||||
// item, ok := covenant.GetReservedByHash(hash)
|
||||
|
|
@ -186,6 +193,13 @@ func HasReservedByHash(hash primitives.Hash) bool {
|
|||
return HasReservedHash(hash)
|
||||
}
|
||||
|
||||
// GetHasReservedByHash is an alias for HasReservedByHash.
|
||||
//
|
||||
// ok := covenant.GetHasReservedByHash(hash)
|
||||
func GetHasReservedByHash(hash primitives.Hash) bool {
|
||||
return HasReservedByHash(hash)
|
||||
}
|
||||
|
||||
// DefaultReservedCatalog returns the lazily loaded reserved-name catalog.
|
||||
//
|
||||
// catalog := covenant.DefaultReservedCatalog()
|
||||
|
|
|
|||
|
|
@ -157,13 +157,25 @@ func TestReservedLookupHasByHashAlias(t *testing.T) {
|
|||
t.Fatal("HasReservedHash should report the reserved reference entry")
|
||||
}
|
||||
|
||||
if !GetHasReservedHash(hash) {
|
||||
t.Fatal("GetHasReservedHash should alias HasReservedHash")
|
||||
}
|
||||
|
||||
if !HasReservedByHash(hash) {
|
||||
t.Fatal("HasReservedByHash should report the reserved reference entry")
|
||||
}
|
||||
|
||||
if !GetHasReservedByHash(hash) {
|
||||
t.Fatal("GetHasReservedByHash should alias HasReservedByHash")
|
||||
}
|
||||
|
||||
if HasReservedHash(primitives.Hash{}) {
|
||||
t.Fatal("HasReservedHash should return false for unknown hashes")
|
||||
}
|
||||
|
||||
if GetHasReservedHash(primitives.Hash{}) {
|
||||
t.Fatal("GetHasReservedHash should return false for unknown hashes")
|
||||
}
|
||||
}
|
||||
|
||||
func TestReservedLookupRejectsUnknownNames(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue