verifier

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sha256

func Sha256(bytes []byte) []byte

Types

type ConsensusVerifier

type ConsensusVerifier struct {
	VerifyCampaign   func(cp *campaign.Campaign) bool
	VerifyTermChange func(cp *campaign.TermChange) bool
	VerifySequencer  func(cp *types.Sequencer) bool
}

consensus related verification

func (*ConsensusVerifier) Independent

func (v *ConsensusVerifier) Independent() bool

func (*ConsensusVerifier) Name

func (c *ConsensusVerifier) Name() string

func (*ConsensusVerifier) String

func (c *ConsensusVerifier) String() string

func (*ConsensusVerifier) Verify

func (c *ConsensusVerifier) Verify(t types.Txi) bool

type GraphVerifier

type GraphVerifier struct {
	Dag    og.IDag
	TxPool pool.ITxPool
}

GraphVerifier verifies if the tx meets the OG hash and graph standards.

func (*GraphVerifier) Independent

func (v *GraphVerifier) Independent() bool

func (*GraphVerifier) Name

func (v *GraphVerifier) Name() string

func (*GraphVerifier) String

func (c *GraphVerifier) String() string

func (*GraphVerifier) Verify

func (v *GraphVerifier) Verify(txi types.Txi) (ok bool)

Verify do the graph validation according to the following rules that are marked as [My job]. Graph standards: A1: [My job] Randomly choose 2 tips. A2: [Not used] Node's parent cannot be its grandparents or ancestors. A3: [My job] Nodes produced by same source must be sequential (tx nonce ++). A4: [------] Double spending once A3 is not followed, whatever there is actual double spending. A5: [Pool's job] If A3 is followed but there is still double spending (tx nonce collision), keep the forked tx with smaller hash A6: [My job] Node cannot reference two un-ordered nodes as its parents B1: [My job] Nodes that are confirmed by at least N (=2) sequencers cannot be referenced. B2: [My job] Two layer hash validation Basically Verify checks whether txs are in their nonce order

type TxFormatVerifier

type TxFormatVerifier struct {
	MaxTxHash         types2.Hash // The difficulty of TxHash
	MaxMinedHash      types2.Hash // The difficulty of MinedHash
	NoVerifyHash      bool
	NoVerifySignatrue bool
	// contains filtered or unexported fields
}

func (*TxFormatVerifier) Independent

func (v *TxFormatVerifier) Independent() bool

func (*TxFormatVerifier) Name

func (v *TxFormatVerifier) Name() string

func (*TxFormatVerifier) SignatureValues

func (t *TxFormatVerifier) SignatureValues(sig []byte) (r, s, v *big.Int, err error)

SignatureValues returns signature values. This signature needs to be in the [R || S || V] format where V is 0 or 1.

func (*TxFormatVerifier) String

func (c *TxFormatVerifier) String() string

func (*TxFormatVerifier) Verify

func (v *TxFormatVerifier) Verify(t types.Txi) bool

func (*TxFormatVerifier) VerifyFrom

func (v *TxFormatVerifier) VerifyFrom(t types.Txi) bool

func (*TxFormatVerifier) VerifyHash

func (v *TxFormatVerifier) VerifyHash(t types.Txi) bool

func (*TxFormatVerifier) VerifySignature

func (v *TxFormatVerifier) VerifySignature(t types.Txi) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL