refactor
This commit is contained in:
28
ots/attestation.go
Normal file
28
ots/attestation.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package ots
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Attestation struct {
|
||||
BitcoinBlockHeight uint64
|
||||
CalendarServerURL string
|
||||
}
|
||||
|
||||
func (att Attestation) Name() string {
|
||||
if att.BitcoinBlockHeight != 0 {
|
||||
return "bitcoin"
|
||||
} else if att.CalendarServerURL != "" {
|
||||
return "pending"
|
||||
} else {
|
||||
return "unknown/broken"
|
||||
}
|
||||
}
|
||||
|
||||
func (att Attestation) Human() string {
|
||||
if att.BitcoinBlockHeight != 0 {
|
||||
return fmt.Sprintf("bitcoin(%d)", att.BitcoinBlockHeight)
|
||||
} else if att.CalendarServerURL != "" {
|
||||
return fmt.Sprintf("pending(%s)", att.CalendarServerURL)
|
||||
} else {
|
||||
return "unknown/broken"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user