Documentation ¶
Index ¶
- Variables
- func FixCountRange(min, max int) (int, int)
- func GenRandomBlock(prevHashCount int, extraBytes []byte, txCount int) *m.BlockExt
- func GenRandomBlockHeader(prevHashCount int, extraBytes []byte) *m.BlockHeader
- func GenRandomBlockHeaderExts(min, max, prevHashCount int, extraBytes []byte) []*m.BlockHeaderExt
- func GenRandomBlocks(min, max, prevHashCount int, extraBytes []byte, txCount int) []*m.BlockExt
- func GenRandomCid() cid.Cid
- func GenRandomHash() m.Hash32
- func GenRandomHashes() []m.Hash32
- func GenRandomTransaction() *m.Transaction
- func GenRandomTransactionExt() *m.TransactionExt
- func GenRandomTransactionExtSlice(min, max int) m.TransactionExtSlice
- func GenTestBlockHeaderWithExtra(extraBytes []byte) *m.BlockHeader
- func GenTestModels()
- func SetUtil(u *m.Util)
- type TransactionNoSig
Constants ¶
This section is empty.
Variables ¶
var ( Mrsh marsha.Marsha = cborgen.New() Crpt = factory.MustNew(crpt.Ed25519, crypto.SHA3_256) Util = model.New(Mrsh, Crpt) )
var ( TestPublicKey crpt.PublicKey TestPrivateKey crpt.PrivateKey TestAddress crpt.Address TestSignature m.Signature TestTransaction m.Transaction TestTransactionHash m.TransactionHash TestTransactionSlice m.TransactionSlice TestBlockHeader m.BlockHeader TestBlock m.Block TestHash = m.Hash32{ 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4, } TestHash2 = m.Hash32{ 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, 0x5, 0x6, 0x7, 0x8, } TestBlockHash = TestHash TestBlockHashes = make([]m.BlockHash, 1) TestAddress2 = m.Address(TestHash) )
Functions ¶
func FixCountRange ¶ added in v0.0.4
func GenRandomBlock ¶ added in v0.0.5
GenRandomBlock creates a random Block for test with the given number of previous block hashes, Extra data and Transactions.
func GenRandomBlockHeader ¶ added in v0.0.5
func GenRandomBlockHeader(prevHashCount int, extraBytes []byte) *m.BlockHeader
GenRandomBlockHeader creates a random BlockHeader for test with the given number of previous block hashes and Extra data.
func GenRandomBlockHeaderExts ¶ added in v0.0.5
func GenRandomBlockHeaderExts(min, max, prevHashCount int, extraBytes []byte) []*m.BlockHeaderExt
GenRandomBlockHeaders creates random BlockHeaderExts for test with the given number of previous block hashes and Extra data.
func GenRandomBlocks ¶ added in v0.0.5
GenRandomBlocks creates random Blocks for test with the given number of previous block hashes, Extra data and Transactions.
func GenRandomHashes ¶
GenRandomHash generates random hashes for test.
func GenRandomTransaction ¶
func GenRandomTransaction() *m.Transaction
GenRandomTransaction generates a random Transaction for test. NOTE: Sig is not a valid signature.
func GenRandomTransactionExt ¶
func GenRandomTransactionExt() *m.TransactionExt
GenRandomTransactionExt generates a random TransactionExt for test.
func GenRandomTransactionExtSlice ¶ added in v0.0.4
func GenRandomTransactionExtSlice(min, max int) m.TransactionExtSlice
GenRandomTransactionExt generates random TransactionExtSlice for test.
func GenTestBlockHeaderWithExtra ¶
func GenTestBlockHeaderWithExtra(extraBytes []byte) *m.BlockHeader
GenTestBlockHeaderWithExtra creates a BlockHeader for test with given Extra data.
Types ¶
type TransactionNoSig ¶
type TransactionNoSig struct { Type m.TransactionType From m.Address Nonce uint64 To m.Address Data []byte Extra []byte }
func (*TransactionNoSig) InitNilEmbeddedStruct ¶
func (t *TransactionNoSig) InitNilEmbeddedStruct()
func (*TransactionNoSig) MarshalCBOR ¶
func (t *TransactionNoSig) MarshalCBOR(w io.Writer) (n int, err error)
func (TransactionNoSig) Ptr ¶
func (t TransactionNoSig) Ptr() marsha.StructPtr
func (*TransactionNoSig) UnmarshalCBOR ¶
func (t *TransactionNoSig) UnmarshalCBOR(r io.Reader) (int, error)
func (*TransactionNoSig) Val ¶
func (p *TransactionNoSig) Val() marsha.Struct