Documentation ¶
Index ¶
- Constants
- func InitPorServer(account *vault.Account, id []byte, s Store, l LocalNode) error
- func SignatureHashWithPenalty(sc *pb.SigChain) ([]byte, error)
- func VerifyID(sc *pb.SigChain, height uint32) error
- func VerifySigChainLight(sc *pb.SigChain, height uint32) error
- func VerifySigChainMeta(sc *pb.SigChain, height uint32) error
- func VerifySigChainPath(sc *pb.SigChain, height uint32) error
- func VerifySigChainSignatures(sc *pb.SigChain) error
- type BacktrackSigChainInfo
- type LocalNode
- type PinSigChainInfo
- type PorPackage
- type PorPackages
- type PorServer
- func (ps *PorServer) AddDestSigChainElem(blockHash, lastHash []byte, sigChainLen int, destElem *pb.SigChainElem) (bool, error)
- func (ps *PorServer) AddSigChainFromTx(txn *transaction.Transaction, currentHeight uint32) (*PorPackage, error)
- func (ps *PorServer) AddSigChainObjection(currentHeight, voteForHeight uint32, sigHash, reporterPubkey []byte) bool
- func (ps *PorServer) BacktrackSigChain(elems []*pb.SigChainElem, hash, senderPubkey []byte) ([]*pb.SigChainElem, []byte, []byte, error)
- func (ps *PorServer) BacktrackSigChainSuccess(hash []byte)
- func (ps *PorServer) CreateSigChainForClient(nonce, dataSize uint32, blockHash []byte, ...) (*pb.SigChain, error)
- func (ps *PorServer) FlushSigChain(blockHash []byte)
- func (ps *PorServer) GetMiningSigChainTxnHash(voteForHeight 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) PinSigChain(hash, senderPubkey []byte) ([]byte, []byte, error)
- func (ps *PorServer) PinSigChainSuccess(hash []byte)
- func (ps *PorServer) PinSrcSigChain(signature []byte) error
- func (ps *PorServer) PopSrcSigChainFromCache(signature []byte) (*pb.SigChain, error)
- func (ps *PorServer) ShouldAddSigChainToCache(currentHeight, voteForHeight uint32, sigHash []byte, replace bool) bool
- func (ps *PorServer) ShouldSignDestSigChainElem(blockHash, lastHash []byte, sigChainLen int) bool
- func (ps *PorServer) UpdateRelayMessage(relayMessage *pb.Relay, nextPubkey, prevNodeID []byte, mining bool) error
- type RecentMiner
- type SkipMiner
- type Store
Constants ¶
const ( // Block proposer of block height X needs to be specified in block X-1, so its // candidate sigchains have to be fully propagated before block X-1 is // proposed, i.e. before block X-2 is accepted. In other words, sigchain can // only propagate 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 propagate when block height <= // X-SigChainPropagationHeightOffset, so it has to start propogating when // block height <= X-SigChainPropagationHeightOffset-SigChainPropogationTime. SigChainMiningHeightOffset = config.SigChainPropogationTime + SigChainPropagationHeightOffset )
const (
MaxNextHopChoice = 4 // should be >= nnet NumFingerSuccessors to avoid false positive
)
Variables ¶
This section is empty.
Functions ¶
func InitPorServer ¶
func VerifySigChainLight ¶
VerifySigChainLight performs light-weighted sigchain verification without verifying signature (CPU intensive) and ID (IO intensive).
func VerifySigChainSignatures ¶
VerifySigChainSignatures returns whether all signatures in sigchain are valid
Types ¶
type BacktrackSigChainInfo ¶
type BacktrackSigChainInfo struct { DestSigChainElem *pb.SigChainElem PrevHash []byte }
type LocalNode ¶
type LocalNode interface {
VerifySigChainObjection(sc *pb.SigChain, reporterID []byte, height uint32) (int, error)
}
LocalNode interface is used to avoid cyclic dependency
type PinSigChainInfo ¶
type PinSigChainInfo struct {
PrevHash []byte
}
type PorPackage ¶
type PorPackage struct { Height uint32 VoteForHeight uint32 BlockHash []byte TxHash []byte SigHash []byte SigChain *pb.SigChain }
func NewPorPackage ¶
func NewPorPackage(txn *transaction.Transaction) (*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) AddSigChainObjection ¶
func (*PorServer) BacktrackSigChain ¶
func (ps *PorServer) BacktrackSigChain(elems []*pb.SigChainElem, hash, senderPubkey []byte) ([]*pb.SigChainElem, []byte, []byte, error)
func (*PorServer) BacktrackSigChainSuccess ¶
BacktrackSigChainSuccess marks a sigchain as backtracked to avoid it being backtracked multiple times.
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) PinSigChain ¶
PinSigChain extends the cache expiration of a key
func (*PorServer) PinSigChainSuccess ¶
PinSigChainSuccess marks a sigchain as pinned to avoid it being pinned multiple times.
func (*PorServer) PinSrcSigChain ¶
PinSrcSigChain marks a src sigchain as pinned to avoid it being pinned multiple times.
func (*PorServer) PopSrcSigChainFromCache ¶
PopSrcSigChainFromCache returns src sigchain and removes it from cache.
func (*PorServer) ShouldAddSigChainToCache ¶
func (*PorServer) ShouldSignDestSigChainElem ¶
type RecentMiner ¶
func GetRecentMiner ¶
func GetRecentMiner(blockHash []byte) (RecentMiner, error)
type Store ¶
type Store interface { GetHeightByBlockHash(hash common.Uint256) (uint32, error) GetHeaderWithCache(hash common.Uint256) (*block.Header, error) GetSigChainWithCache(hash common.Uint256) (*pb.SigChain, error) GetID(publicKey []byte, height uint32) ([]byte, error) }
Store interface is used to avoid cyclic dependency