Documentation ¶
Index ¶
- Constants
- Variables
- func InitPorServer(account *vault.Account, id []byte) error
- func VerifyID(sc *pb.SigChain) error
- type BacktrackSigChainInfo
- type PorPackage
- type PorPackages
- type PorServer
- func (ps *PorServer) AddDestSigChainElem(blockHash, lastSignature []byte, sigChainLen int, destElem *pb.SigChainElem) (bool, error)
- func (ps *PorServer) AddSigChainFromTx(txn *transaction.Transaction, currentHeight uint32) (*PorPackage, error)
- func (ps *PorServer) BacktrackSigChain(elems []*pb.SigChainElem, signature, senderPubkey []byte) ([]*pb.SigChainElem, []byte, []byte, error)
- func (ps *PorServer) CreateSigChainForClient(nonce, dataSize uint32, blockHash []byte, ...) (*pb.SigChain, error)
- func (ps *PorServer) FlushSigChain(blockHash []byte)
- func (ps *PorServer) GetMiningSigChainTxnHash(height uint32) (common.Uint256, error)
- func (ps *PorServer) GetOrComputeVrf(data []byte) ([]byte, []byte, error)
- func (ps *PorServer) GetSigChainTxn(txnHash common.Uint256) (*transaction.Transaction, error)
- func (ps *PorServer) GetSigChainTxnByShortHash(shortHash []byte) (*transaction.Transaction, error)
- func (ps *PorServer) GetSigChainTxnBySigHash(sigHash []byte) (*transaction.Transaction, error)
- func (ps *PorServer) GetSignature(sc *pb.SigChain) ([]byte, error)
- func (ps *PorServer) GetSrcSigChainFromCache(signature []byte) (*pb.SigChain, error)
- func (ps *PorServer) LenOfSigChain(sc *pb.SigChain) int
- func (ps *PorServer) ShouldAddSigChainToCache(currentHeight, voteForHeight uint32, sigHash []byte) bool
- func (ps *PorServer) ShouldSignDestSigChainElem(blockHash, lastSignature []byte, sigChainLen int) bool
- func (ps *PorServer) Sign(relayMessage *pb.Relay, nextPubkey, prevNodeID []byte, mining bool) error
Constants ¶
View Source
const ( // Block proposer of block height X needs to be specified in block X-1, so its // candidate sigchains have to be fully propogated before block X-1 is // proposed, i.e. before block X-2 is accepted. In other words, sigchain can // only propogate when block height <= X-3. SigChainPropagationHeightOffset = 3 // Block proposer of block height X is chosen from sigchain produced during // block X-SigChainPropagationHeightOffset-SigChainPropogationTime because // sigchain can only propogate when block height <= // X-SigChainPropagationHeightOffset, so it has to start propogating when // block height <= X-SigChainPropagationHeightOffset-SigChainPropogationTime. SigChainMiningHeightOffset = config.SigChainPropogationTime + SigChainPropagationHeightOffset )
Variables ¶
Functions ¶
Types ¶
type BacktrackSigChainInfo ¶
type BacktrackSigChainInfo struct { DestSigChainElem *pb.SigChainElem PrevSignature []byte }
type PorPackage ¶
type PorPackage struct { VoteForHeight uint32 `protobuf:"varint,1,opt,name=VoteForHeight,proto3" json:"VoteForHeight,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 *pb.SigChain `protobuf:"bytes,6,opt,name=SigChain" json:"SigChain,omitempty"` }
func NewPorPackage ¶
func NewPorPackage(txn *transaction.Transaction, shouldVerify bool) (*PorPackage, 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) AddDestSigChainElem ¶
func (*PorServer) AddSigChainFromTx ¶
func (ps *PorServer) AddSigChainFromTx(txn *transaction.Transaction, currentHeight uint32) (*PorPackage, error)
func (*PorServer) BacktrackSigChain ¶
func (ps *PorServer) BacktrackSigChain(elems []*pb.SigChainElem, signature, senderPubkey []byte) ([]*pb.SigChainElem, []byte, []byte, error)
func (*PorServer) CreateSigChainForClient ¶
func (*PorServer) FlushSigChain ¶
func (*PorServer) GetMiningSigChainTxnHash ¶
func (*PorServer) GetOrComputeVrf ¶
func (*PorServer) GetSigChainTxn ¶
func (ps *PorServer) GetSigChainTxn(txnHash common.Uint256) (*transaction.Transaction, error)
func (*PorServer) GetSigChainTxnByShortHash ¶
func (ps *PorServer) GetSigChainTxnByShortHash(shortHash []byte) (*transaction.Transaction, error)
func (*PorServer) GetSigChainTxnBySigHash ¶
func (ps *PorServer) GetSigChainTxnBySigHash(sigHash []byte) (*transaction.Transaction, error)
func (*PorServer) GetSrcSigChainFromCache ¶
func (*PorServer) ShouldAddSigChainToCache ¶
func (*PorServer) ShouldSignDestSigChainElem ¶
Click to show internal directories.
Click to hide internal directories.