Documentation ¶
Index ¶
- Constants
- Variables
- func InitPorServer(account *vault.Account, id []byte) error
- type PorPackage
- func (pp *PorPackage) CompareTo(o *PorPackage) int
- func (*PorPackage) Descriptor() ([]byte, []int)
- func (pp *PorPackage) DumpInfo()
- func (this *PorPackage) Equal(that interface{}) bool
- func (m *PorPackage) GetBlockHash() []byte
- func (m *PorPackage) GetOwner() []byte
- func (m *PorPackage) GetSigChain() *SigChain
- func (m *PorPackage) GetSigHash() []byte
- func (m *PorPackage) GetTxHash() []byte
- func (m *PorPackage) GetVoteForHeight() uint32
- func (this *PorPackage) GoString() string
- func (m *PorPackage) Marshal() (dAtA []byte, err error)
- func (m *PorPackage) MarshalTo(dAtA []byte) (int, error)
- func (*PorPackage) ProtoMessage()
- func (m *PorPackage) Reset()
- func (m *PorPackage) Size() (n int)
- func (this *PorPackage) String() string
- func (m *PorPackage) Unmarshal(dAtA []byte) error
- func (m *PorPackage) XXX_DiscardUnknown()
- func (m *PorPackage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *PorPackage) XXX_Merge(src proto.Message)
- func (m *PorPackage) XXX_Size() int
- func (m *PorPackage) XXX_Unmarshal(b []byte) error
- type PorPackages
- type PorServer
- func (ps *PorServer) AddSigChainFromTx(txn *transaction.Transaction, currentHeight uint32) (bool, error)
- func (ps *PorServer) CreateSigChain(dataSize uint32, dataHash, blockHash *common.Uint256, ...) (*SigChain, error)
- func (ps *PorServer) CreateSigChainForClient(dataSize uint32, dataHash, blockHash *common.Uint256, ...) (*SigChain, error)
- func (ps *PorServer) GetMiningSigChain(height uint32) (*SigChain, error)
- func (ps *PorServer) GetMiningSigChainTxn(txnHash common.Uint256) (*transaction.Transaction, error)
- func (ps *PorServer) GetMiningSigChainTxnHash(height uint32) (common.Uint256, error)
- func (ps *PorServer) GetSignature(sc *SigChain) ([]byte, error)
- func (ps *PorServer) GetThreshold() common.Uint256
- func (ps *PorServer) IsFinal(sc *SigChain) bool
- func (ps *PorServer) IsSatisfyThreshold() bool
- func (ps *PorServer) LenOfSigChain(sc *SigChain) int
- func (ps *PorServer) Sign(sc *SigChain, nextPubkey []byte, mining bool) error
- func (ps *PorServer) UpdateThreshold() common.Uint256
- func (ps *PorServer) Verify(sc *SigChain) error
- type PorStore
- type SigAlgo
- type SigChain
- func (sc *SigChain) AddLastSignature(signature []byte) error
- func (*SigChain) Descriptor() ([]byte, []int)
- func (sc *SigChain) DumpInfo()
- func (this *SigChain) Equal(that interface{}) bool
- func (sc *SigChain) ExtendElement(addr, nextPubkey []byte, mining bool) ([]byte, error)
- func (m *SigChain) GetBlockHash() []byte
- func (m *SigChain) GetDataHash() []byte
- func (m *SigChain) GetDataSize() uint32
- func (m *SigChain) GetDestPubkey() []byte
- func (m *SigChain) GetElems() []*SigChainElem
- func (sc *SigChain) GetLastPubkey() ([]byte, error)
- func (sc *SigChain) GetMiner() ([]byte, []byte, error)
- func (m *SigChain) GetNonce() uint32
- func (sc *SigChain) GetOwner() ([]byte, error)
- func (sc *SigChain) GetSignature() ([]byte, error)
- func (sc *SigChain) GetSignerIndex(pubkey []byte) (int, error)
- func (m *SigChain) GetSrcPubkey() []byte
- func (this *SigChain) GoString() string
- func (sc *SigChain) IsFinal() bool
- func (sc *SigChain) Length() int
- func (m *SigChain) Marshal() (dAtA []byte, err error)
- func (m *SigChain) MarshalTo(dAtA []byte) (int, error)
- func (sc *SigChain) Path() [][]byte
- func (*SigChain) ProtoMessage()
- func (m *SigChain) Reset()
- func (sc *SigChain) SerializationMetadata(w io.Writer) error
- func (sc *SigChain) Sign(addr, nextPubkey []byte, mining bool, signer *vault.Account) error
- func (sc *SigChain) SignatureHash() ([]byte, error)
- func (m *SigChain) Size() (n int)
- func (this *SigChain) String() string
- func (m *SigChain) Unmarshal(dAtA []byte) error
- func (sc *SigChain) Verify() error
- func (sc *SigChain) VerifyPath() error
- func (m *SigChain) XXX_DiscardUnknown()
- func (m *SigChain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SigChain) XXX_Merge(src proto.Message)
- func (m *SigChain) XXX_Size() int
- func (m *SigChain) XXX_Unmarshal(b []byte) error
- type SigChainElem
- func (*SigChainElem) Descriptor() ([]byte, []int)
- func (this *SigChainElem) Equal(that interface{}) bool
- func (m *SigChainElem) GetAddr() []byte
- func (m *SigChainElem) GetMining() bool
- func (m *SigChainElem) GetNextPubkey() []byte
- func (m *SigChainElem) GetSigAlgo() SigAlgo
- func (m *SigChainElem) GetSignature() []byte
- func (this *SigChainElem) GoString() string
- func (m *SigChainElem) Marshal() (dAtA []byte, err error)
- func (m *SigChainElem) MarshalTo(dAtA []byte) (int, error)
- func (*SigChainElem) ProtoMessage()
- func (m *SigChainElem) Reset()
- func (sce *SigChainElem) SerializationUnsigned(w io.Writer) error
- func (m *SigChainElem) Size() (n int)
- func (this *SigChainElem) String() string
- func (m *SigChainElem) Unmarshal(dAtA []byte) error
- func (m *SigChainElem) XXX_DiscardUnknown()
- func (m *SigChainElem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SigChainElem) XXX_Merge(src proto.Message)
- func (m *SigChainElem) XXX_Size() int
- func (m *SigChainElem) XXX_Unmarshal(b []byte) error
Constants ¶
View Source
const ( // The height of signature chain which run for block proposer should be (local block height -1 + 5) // -1 means that: // local block height may heigher than neighbor node at most 1 // +5 means that: // if local block height is n, then n + 3 signature chain is in consensus) + // 1 (since local node height may lower than neighbors at most 1) + // 1 (for fully propagate) SigChainBlockHeightOffset = 1 SigChainMiningHeightOffset = 4 )
Variables ¶
View Source
var ( ErrInvalidLengthPorpackage = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowPorpackage = fmt.Errorf("proto: integer overflow") )
View Source
var ( ErrInvalidLengthSigchain = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowSigchain = fmt.Errorf("proto: integer overflow") )
View Source
var SigAlgo_name = map[int32]string{
0: "ECDSA",
}
View Source
var SigAlgo_value = map[string]int32{
"ECDSA": 0,
}
Functions ¶
Types ¶
type PorPackage ¶
type PorPackage struct { VoteForHeight uint32 `protobuf:"varint,1,opt,name=VoteForHeight,proto3" json:"VoteForHeight,omitempty"` Owner []byte `protobuf:"bytes,2,opt,name=Owner,proto3" json:"Owner,omitempty"` BlockHash []byte `protobuf:"bytes,3,opt,name=BlockHash,proto3" json:"BlockHash,omitempty"` TxHash []byte `protobuf:"bytes,4,opt,name=TxHash,proto3" json:"TxHash,omitempty"` SigHash []byte `protobuf:"bytes,5,opt,name=SigHash,proto3" json:"SigHash,omitempty"` SigChain *SigChain `protobuf:"bytes,6,opt,name=SigChain" json:"SigChain,omitempty"` }
func NewPopulatedPorPackage ¶
func NewPopulatedPorPackage(r randyPorpackage, easy bool) *PorPackage
func NewPorPackage ¶
func NewPorPackage(txn *transaction.Transaction) (*PorPackage, error)
func (*PorPackage) CompareTo ¶
func (pp *PorPackage) CompareTo(o *PorPackage) int
func (*PorPackage) Descriptor ¶
func (*PorPackage) Descriptor() ([]byte, []int)
func (*PorPackage) DumpInfo ¶
func (pp *PorPackage) DumpInfo()
func (*PorPackage) Equal ¶
func (this *PorPackage) Equal(that interface{}) bool
func (*PorPackage) GetBlockHash ¶
func (m *PorPackage) GetBlockHash() []byte
func (*PorPackage) GetOwner ¶
func (m *PorPackage) GetOwner() []byte
func (*PorPackage) GetSigChain ¶
func (m *PorPackage) GetSigChain() *SigChain
func (*PorPackage) GetSigHash ¶
func (m *PorPackage) GetSigHash() []byte
func (*PorPackage) GetTxHash ¶
func (m *PorPackage) GetTxHash() []byte
func (*PorPackage) GetVoteForHeight ¶
func (m *PorPackage) GetVoteForHeight() uint32
func (*PorPackage) GoString ¶
func (this *PorPackage) GoString() string
func (*PorPackage) Marshal ¶
func (m *PorPackage) Marshal() (dAtA []byte, err error)
func (*PorPackage) ProtoMessage ¶
func (*PorPackage) ProtoMessage()
func (*PorPackage) Reset ¶
func (m *PorPackage) Reset()
func (*PorPackage) Size ¶
func (m *PorPackage) Size() (n int)
func (*PorPackage) String ¶
func (this *PorPackage) String() string
func (*PorPackage) Unmarshal ¶
func (m *PorPackage) Unmarshal(dAtA []byte) error
func (*PorPackage) XXX_DiscardUnknown ¶
func (m *PorPackage) XXX_DiscardUnknown()
func (*PorPackage) XXX_Marshal ¶
func (m *PorPackage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PorPackage) XXX_Merge ¶
func (dst *PorPackage) XXX_Merge(src proto.Message)
func (*PorPackage) XXX_Size ¶
func (m *PorPackage) XXX_Size() int
func (*PorPackage) XXX_Unmarshal ¶
func (m *PorPackage) XXX_Unmarshal(b []byte) error
type PorPackages ¶
type PorPackages []*PorPackage
func (PorPackages) Len ¶
func (c PorPackages) Len() int
func (PorPackages) Less ¶
func (c PorPackages) Less(i, j int) bool
func (PorPackages) Swap ¶
func (c PorPackages) Swap(i, j int)
type PorServer ¶
func GetPorServer ¶
func GetPorServer() *PorServer
func (*PorServer) AddSigChainFromTx ¶
func (ps *PorServer) AddSigChainFromTx(txn *transaction.Transaction, currentHeight uint32) (bool, error)
func (*PorServer) CreateSigChain ¶
func (*PorServer) CreateSigChainForClient ¶
func (*PorServer) GetMiningSigChain ¶
func (*PorServer) GetMiningSigChainTxn ¶
func (ps *PorServer) GetMiningSigChainTxn(txnHash common.Uint256) (*transaction.Transaction, error)
func (*PorServer) GetMiningSigChainTxnHash ¶
func (*PorServer) GetThreshold ¶
func (*PorServer) IsSatisfyThreshold ¶
func (*PorServer) LenOfSigChain ¶
func (*PorServer) UpdateThreshold ¶
type SigChain ¶
type SigChain struct { Nonce uint32 `protobuf:"varint,1,opt,name=Nonce,proto3" json:"Nonce,omitempty"` DataSize uint32 `protobuf:"varint,2,opt,name=DataSize,proto3" json:"DataSize,omitempty"` DataHash []byte `protobuf:"bytes,3,opt,name=DataHash,proto3" json:"DataHash,omitempty"` BlockHash []byte `protobuf:"bytes,4,opt,name=BlockHash,proto3" json:"BlockHash,omitempty"` SrcPubkey []byte `protobuf:"bytes,5,opt,name=SrcPubkey,proto3" json:"SrcPubkey,omitempty"` DestPubkey []byte `protobuf:"bytes,6,opt,name=DestPubkey,proto3" json:"DestPubkey,omitempty"` Elems []*SigChainElem `protobuf:"bytes,7,rep,name=Elems" json:"Elems,omitempty"` }
func NewPopulatedSigChain ¶
func NewSigChain ¶
func NewSigChain(srcAccount *vault.Account, dataSize uint32, dataHash, blockHash, srcID, destPubkey, nextPubkey []byte, mining bool) (*SigChain, error)
first relay node starts a new signature chain which consists of meta data and the first element.
func (*SigChain) AddLastSignature ¶
func (*SigChain) Descriptor ¶
func (*SigChain) ExtendElement ¶
func (*SigChain) GetBlockHash ¶
func (*SigChain) GetDataHash ¶
func (*SigChain) GetDataSize ¶
func (*SigChain) GetDestPubkey ¶
func (*SigChain) GetElems ¶
func (m *SigChain) GetElems() []*SigChainElem
func (*SigChain) GetLastPubkey ¶
func (*SigChain) GetSignature ¶
func (*SigChain) GetSrcPubkey ¶
func (*SigChain) ProtoMessage ¶
func (*SigChain) ProtoMessage()
func (*SigChain) SerializationMetadata ¶
func (*SigChain) SignatureHash ¶
func (*SigChain) VerifyPath ¶
func (*SigChain) XXX_DiscardUnknown ¶
func (m *SigChain) XXX_DiscardUnknown()
func (*SigChain) XXX_Marshal ¶
func (*SigChain) XXX_Unmarshal ¶
type SigChainElem ¶
type SigChainElem struct { Addr []byte `protobuf:"bytes,1,opt,name=Addr,proto3" json:"Addr,omitempty"` NextPubkey []byte `protobuf:"bytes,2,opt,name=NextPubkey,proto3" json:"NextPubkey,omitempty"` Mining bool `protobuf:"varint,3,opt,name=Mining,proto3" json:"Mining,omitempty"` SigAlgo SigAlgo `protobuf:"varint,4,opt,name=SigAlgo,proto3,enum=por.SigAlgo" json:"SigAlgo,omitempty"` Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` }
func NewPopulatedSigChainElem ¶
func NewPopulatedSigChainElem(r randySigchain, easy bool) *SigChainElem
func NewSigChainElem ¶
func NewSigChainElem(addr, nextPubkey []byte, mining bool) *SigChainElem
func (*SigChainElem) Descriptor ¶
func (*SigChainElem) Descriptor() ([]byte, []int)
func (*SigChainElem) Equal ¶
func (this *SigChainElem) Equal(that interface{}) bool
func (*SigChainElem) GetAddr ¶
func (m *SigChainElem) GetAddr() []byte
func (*SigChainElem) GetMining ¶
func (m *SigChainElem) GetMining() bool
func (*SigChainElem) GetNextPubkey ¶
func (m *SigChainElem) GetNextPubkey() []byte
func (*SigChainElem) GetSigAlgo ¶
func (m *SigChainElem) GetSigAlgo() SigAlgo
func (*SigChainElem) GetSignature ¶
func (m *SigChainElem) GetSignature() []byte
func (*SigChainElem) GoString ¶
func (this *SigChainElem) GoString() string
func (*SigChainElem) Marshal ¶
func (m *SigChainElem) Marshal() (dAtA []byte, err error)
func (*SigChainElem) ProtoMessage ¶
func (*SigChainElem) ProtoMessage()
func (*SigChainElem) Reset ¶
func (m *SigChainElem) Reset()
func (*SigChainElem) SerializationUnsigned ¶
func (sce *SigChainElem) SerializationUnsigned(w io.Writer) error
func (*SigChainElem) Size ¶
func (m *SigChainElem) Size() (n int)
func (*SigChainElem) String ¶
func (this *SigChainElem) String() string
func (*SigChainElem) Unmarshal ¶
func (m *SigChainElem) Unmarshal(dAtA []byte) error
func (*SigChainElem) XXX_DiscardUnknown ¶
func (m *SigChainElem) XXX_DiscardUnknown()
func (*SigChainElem) XXX_Marshal ¶
func (m *SigChainElem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SigChainElem) XXX_Merge ¶
func (dst *SigChainElem) XXX_Merge(src proto.Message)
func (*SigChainElem) XXX_Size ¶
func (m *SigChainElem) XXX_Size() int
func (*SigChainElem) XXX_Unmarshal ¶
func (m *SigChainElem) XXX_Unmarshal(b []byte) error
Click to show internal directories.
Click to hide internal directories.