Browse Source

Signature bytes

pull/1782/head
Jae Kwon 9 years ago
parent
commit
3f0d9b3f29
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      signature.go

+ 5
- 0
signature.go View File

@ -9,6 +9,7 @@ import (
// Signature is a part of Txs and consensus Votes. // Signature is a part of Txs and consensus Votes.
type Signature interface { type Signature interface {
Bytes() []byte
IsZero() bool IsZero() bool
String() string String() string
} }
@ -29,6 +30,10 @@ var _ = wire.RegisterInterface(
// Implements Signature // Implements Signature
type SignatureEd25519 [64]byte type SignatureEd25519 [64]byte
func (sig SignatureEd25519) Bytes() []byte {
return wire.BinaryBytes(struct{ Signature }{sig})
}
func (sig SignatureEd25519) IsZero() bool { return len(sig) == 0 } func (sig SignatureEd25519) IsZero() bool { return len(sig) == 0 }
func (sig SignatureEd25519) String() string { return fmt.Sprintf("/%X.../", Fingerprint(sig[:])) } func (sig SignatureEd25519) String() string { return fmt.Sprintf("/%X.../", Fingerprint(sig[:])) }

Loading…
Cancel
Save