github.com/status-im/status-go@v1.1.0/protocol/ens/record.go (about)

     1  package ens
     2  
     3  import (
     4  	"math"
     5  	"strings"
     6  )
     7  
     8  type VerificationRecord struct {
     9  	PublicKey           string
    10  	Name                string
    11  	Clock               uint64
    12  	Verified            bool
    13  	VerifiedAt          uint64
    14  	VerificationRetries uint64
    15  	NextRetry           uint64
    16  }
    17  
    18  // We calculate if it's too early to retry, by exponentially backing off
    19  func (e *VerificationRecord) CalculateNextRetry() {
    20  	e.NextRetry = e.VerifiedAt + ENSBackoffTimeSec*uint64(math.Exp2(float64(e.VerificationRetries)))
    21  }
    22  
    23  func (e *VerificationRecord) Valid() bool {
    24  	return e.Name != "" && strings.HasSuffix(e.Name, ".eth") && e.Clock > 0
    25  }