txmaker

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: 16 Imported by: 0

Documentation

Overview

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionTxBuildRequest

type ActionTxBuildRequest struct {
	UnsignedTxBuildRequest
	Action    byte
	EnableSpo bool
	TokenName string
	Pubkey    crypto.PublicKey
	Sig       crypto.Signature
}

type FIFOTipGenerator

type FIFOTipGenerator struct {
	// contains filtered or unexported fields
}

FIFOTipGenerator wraps txpool random picker so that when tps is low, the graph will not be like a chain.

func NewFIFOTIpGenerator

func NewFIFOTIpGenerator(upstream TipGenerator, maxCacheSize int) *FIFOTipGenerator

func (*FIFOTipGenerator) GetByNonce

func (f *FIFOTipGenerator) GetByNonce(addr common.Address, nonce uint64) types.Txi

func (*FIFOTipGenerator) GetRandomTips

func (f *FIFOTipGenerator) GetRandomTips(n int) (v []types.Txi)

func (*FIFOTipGenerator) IsBadSeq

func (f *FIFOTipGenerator) IsBadSeq(seq *types.Sequencer) error

type InfoProvider

type InfoProvider interface {
}

InfoProvider defines ways to access chain info It is necessary for txmaker to pick up parents and make txs. Known provider inplements include RPC provider and embeded provider

type OGTxCreator

type OGTxCreator struct {
	Miner              *miner.PoWMiner
	TipGenerator       TipGenerator      // usually tx_pool
	MaxTxHash          types2.Hash       // The difficultiy of TxHash
	MaxMinedHash       types2.Hash       // The difficultiy of MinedHash
	MaxConnectingTries int               // Max number of times to find a pair of parents. If exceeded, try another nonce.
	DebugNodeId        int               // Only for debug. This value indicates tx sender and is temporarily saved to tx.height
	GraphVerifier      protocol.Verifier // To verify the graph structure

	NoVerifyMineHash  bool
	NoVerifyMaxTxHash bool
	StateRootProvider StateRootProvider
	// contains filtered or unexported fields
}

OGTxCreator creates tx and do the signing and mining for OG.

func (*OGTxCreator) GenerateSequencer

func (m *OGTxCreator) GenerateSequencer(issuer common.Address, height uint64, accountNonce uint64,
	privateKey *crypto.PrivateKey, blsPubKey []byte) (seq *types.Sequencer, reterr error, genAgain bool)

func (*OGTxCreator) GetArchiveNonce

func (t *OGTxCreator) GetArchiveNonce() uint64

func (*OGTxCreator) NewSignedSequencer

func (m *OGTxCreator) NewSignedSequencer(req SignedSequencerBuildRequest) types.Txi

NewSignedSequencer this function is for test

func (*OGTxCreator) NewSignedTx

func (m *OGTxCreator) NewSignedTx(req SignedTxBuildRequest) types.Txi

func (*OGTxCreator) NewTxWithSeal

func (m *OGTxCreator) NewTxWithSeal(req TxWithSealBuildRequest) (tx types.Txi, err error)

func (*OGTxCreator) SealTx

func (m *OGTxCreator) SealTx(tx types.Txi, priveKey *crypto.PrivateKey) (ok bool)

SealTx do mining first, then pick up parents from tx pool which could leads to a proper hash. If there is no proper parents, Mine again.

func (*OGTxCreator) Stop

func (t *OGTxCreator) Stop()

func (*OGTxCreator) ValidateSequencer

func (t *OGTxCreator) ValidateSequencer(seq types.Sequencer) error

type SignedSequencerBuildRequest

type SignedSequencerBuildRequest struct {
	UnsignedSequencerBuildRequest
	PrivateKey crypto.PrivateKey
}

type SignedTxBuildRequest

type SignedTxBuildRequest struct {
	UnsignedTxBuildRequest
	PrivateKey crypto.PrivateKey
}

type StateRootProvider

type StateRootProvider interface {
	PreConfirm(seq *types.Sequencer) (hash types2.Hash, err error)
}

type TipGenerator

type TipGenerator interface {
	GetRandomTips(n int) (v []types.Txi)
	GetByNonce(addr common.Address, nonce uint64) types.Txi
	IsBadSeq(seq *types.Sequencer) error
}

type TxMaker

type TxMaker interface {
	MakeTx(txType types.TxBaseType) types.Txi
}

TxMaker makes new Tx (or Seq) using the infomation that InfoProvider gives.

type TxWithSealBuildRequest

type TxWithSealBuildRequest struct {
	From    common.Address
	To      common.Address
	Value   *math.BigInt
	Data    []byte
	Nonce   uint64
	Pubkey  crypto.PublicKey
	Sig     crypto.Signature
	TokenId int32
}

type UnsignedSequencerBuildRequest

type UnsignedSequencerBuildRequest struct {
	Issuer       common.Address
	Height       uint64
	AccountNonce uint64
}

type UnsignedTxBuildRequest

type UnsignedTxBuildRequest struct {
	From         common.Address
	To           common.Address
	Value        *math.BigInt
	AccountNonce uint64
	TokenId      int32
}

Jump to

Keyboard shortcuts

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