Skip to content

Commit 235d781

Browse files
authored
Merge pull request #84 from blinklabs-io/fix/query-root-domain
fix: store on-chain domain using canonical name
2 parents 821fb20 + b37a26b commit 235d781

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

internal/dns/dns.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ func findNameserversForDomain(
292292
// Check on-chain domains first
293293
for startLabelIdx := 0; startLabelIdx < len(queryLabels); startLabelIdx++ {
294294
lookupDomainName := strings.Join(queryLabels[startLabelIdx:], ".")
295+
// Convert to canonical form for consistency
296+
lookupDomainName = dns.CanonicalName(lookupDomainName)
295297
nameservers, err := state.GetState().LookupDomain(lookupDomainName)
296298
if err != nil {
297299
return "", nil, err

internal/indexer/indexer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
input_chainsync "github.com/blinklabs-io/snek/input/chainsync"
2424
output_embedded "github.com/blinklabs-io/snek/output/embedded"
2525
"github.com/blinklabs-io/snek/pipeline"
26+
"github.com/miekg/dns"
2627
)
2728

2829
type Domain struct {
@@ -169,6 +170,8 @@ func (i *Indexer) handleEvent(evt event.Event) error {
169170
continue
170171
}
171172
domainName := string(dnsDomain.Origin)
173+
// Convert to canonical form for consistency
174+
domainName = dns.CanonicalName(domainName)
172175
nameServers := map[string]string{}
173176
for _, record := range dnsDomain.Records {
174177
// NOTE: we're losing information here, but we need to revamp the storage

0 commit comments

Comments
 (0)