mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 04:01:55 +00:00
updated block types
This commit is contained in:
@@ -5,64 +5,6 @@ import (
|
||||
"io"
|
||||
)
|
||||
|
||||
type AccountId interface {
|
||||
Binary
|
||||
Type() Byte
|
||||
}
|
||||
|
||||
const (
|
||||
ACCOUNT_TYPE_NUMBER = Byte(0x00)
|
||||
ACCOUNT_TYPE_PUBKEY = Byte(0x01)
|
||||
)
|
||||
|
||||
/* AccountNumber < AccountId */
|
||||
|
||||
type AccountNumber uint64
|
||||
|
||||
func (self AccountNumber) Type() Byte {
|
||||
return ACCOUNT_TYPE_NUMBER
|
||||
}
|
||||
|
||||
func (self AccountNumber) Equals(o Binary) bool {
|
||||
return self == o
|
||||
}
|
||||
|
||||
func (self AccountNumber) ByteSize() int {
|
||||
return 1 + 8
|
||||
}
|
||||
|
||||
func (self AccountNumber) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var n_ int64
|
||||
n_, err = self.Type().WriteTo(w)
|
||||
n += n_; if err != nil { return n, err }
|
||||
n_, err = UInt64(self).WriteTo(w)
|
||||
n += n_; return
|
||||
}
|
||||
|
||||
/* AccountPubKey < AccountId */
|
||||
|
||||
type AccountPubKey []byte
|
||||
|
||||
func (self AccountPubKey) Type() Byte {
|
||||
return ACCOUNT_TYPE_PUBKEY
|
||||
}
|
||||
|
||||
func (self AccountPubKey) Equals(o Binary) bool {
|
||||
return ByteSlice(self).Equals(o)
|
||||
}
|
||||
|
||||
func (self AccountPubKey) ByteSize() int {
|
||||
return 1 + ByteSlice(self).ByteSize()
|
||||
}
|
||||
|
||||
func (self AccountPubKey) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var n_ int64
|
||||
n_, err = self.Type().WriteTo(w)
|
||||
n += n_; if err != nil { return n, err }
|
||||
n_, err = ByteSlice(self).WriteTo(w)
|
||||
n += n_; return
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Signature message wire format:
|
||||
@@ -81,6 +23,10 @@ type Signature struct {
|
||||
SigBytes ByteSlice
|
||||
}
|
||||
|
||||
func ReadSignature(r io.Reader) *Signature {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *Signature) Equals(other Binary) bool {
|
||||
if o, ok := other.(*Signature); ok {
|
||||
return self.Signer.Equals(o.Signer) &&
|
||||
@@ -90,11 +36,6 @@ func (self *Signature) Equals(other Binary) bool {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *Signature) ByteSize() int {
|
||||
return self.Signer.ByteSize() +
|
||||
self.SigBytes.ByteSize()
|
||||
}
|
||||
|
||||
func (self *Signature) WriteTo(w io.Writer) (n int64, err error) {
|
||||
var n_ int64
|
||||
n_, err = self.Signer.WriteTo(w)
|
||||
@@ -106,8 +47,3 @@ func (self *Signature) WriteTo(w io.Writer) (n int64, err error) {
|
||||
func (self *Signature) Verify(msg ByteSlice) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func ReadSignature(buf []byte, start int) (*Signature, int) {
|
||||
return nil, 0
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user