tx

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: BSD-2-Clause Imports: 18 Imported by: 59

Documentation

Index

Constants

View Source
const (
	TxOrphan = iota
	TxInvalid
	CoinAmount = 100000000
)
View Source
const (
	RequireStandard = 1
	DefaultVersion  = 0x01
)
View Source
const (
	MaxMoney = 21000000 * CoinAmount

	// MaxTxSigOpsCounts the maximum allowed number of signature check operations per transaction (network rule)
	MaxTxSigOpsCounts = 20000

	FreeListMaxItems  = 12500
	MaxMessagePayload = 32 * 1024 * 1024
	MinTxInPayload    = 9 + util.Hash256Size
	MaxTxInPerMessage = (MaxMessagePayload / MinTxInPayload) + 1
	TxVersion         = 1
)
View Source
const (
	DefaultBlockPriorityPercentage int64 = 5

	MaxStandardVersion = 2

	/*MaxStandardTxSize the maximum size for transactions we're willing to relay/mine */
	MaxStandardTxSize uint = 100000

	/*MaxP2SHSigOps maximum number of signature check operations in an IsStandard() P2SH script*/
	MaxP2SHSigOps uint = 15

	/*MaxStandardTxSigOps the maximum number of sigops we're willing to relay/mine in a single tx */
	MaxStandardTxSigOps = uint(consensus.MaxTxSigOpsCount / 5)

	// DefaultIncrementalRelayFee is default for -incrementalrelayfee, which sets the minimum feerate increase
	// for mempool limiting or BIP 125 replacement
	DefaultIncrementalRelayFee int64 = 1000

	// DefaultBytesPerSigop is default for -bytespersigop
	DefaultBytesPerSigop uint = 20

	// MaxStandardP2WSHStackItems is the maximum number of witness stack items in a standard P2WSH script
	MaxStandardP2WSHStackItems uint = 100

	/*MaxStandardP2WSHStackItemSize the maximum size of each witness stack item in a standard P2WSH script */
	MaxStandardP2WSHStackItemSize uint = 80

	/*MaxStandardP2WSHScriptSize the maximum size of a standard witnessScript */
	MaxStandardP2WSHScriptSize uint = 3600

	/*StandardLockTimeVerifyFlags used as the flags parameter to sequence and LockTime checks in
	 * non-core code. */
	StandardLockTimeVerifyFlags uint = consensus.LocktimeVerifySequence | consensus.LocktimeMedianTimePast
)

Variables

This section is empty.

Functions

func CheckSig

func CheckSig(signHash util.Hash, vchSigIn []byte, vchPubKey []byte) bool

func GetOutputsHash

func GetOutputsHash(outs []*txout.TxOut) (h util.Hash, err error)

func GetPreviousOutHash

func GetPreviousOutHash(tx *Tx) (h util.Hash)

func GetSequenceHash

func GetSequenceHash(tx *Tx) (h util.Hash)

func SignatureHash

func SignatureHash(transaction *Tx, s *script.Script, hashType uint32, nIn int,
	money amount.Amount, flags uint32) (result util.Hash, err error)

Types

type Tx

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

func NewEmptyTx

func NewEmptyTx() *Tx

func NewGenesisCoinbaseTx

func NewGenesisCoinbaseTx() *Tx

func NewTx

func NewTx(locktime uint32, version int32) *Tx

func (*Tx) AddTxIn

func (tx *Tx) AddTxIn(txIn *txin.TxIn)

func (*Tx) AddTxOut

func (tx *Tx) AddTxOut(txOut *txout.TxOut)

func (*Tx) CalculateModifiedSize

func (tx *Tx) CalculateModifiedSize() uint32

func (*Tx) CheckCoinbaseTransaction

func (tx *Tx) CheckCoinbaseTransaction() error

func (*Tx) CheckDuplicateIns

func (tx *Tx) CheckDuplicateIns(outpoints *map[outpoint.OutPoint]bool) error

func (*Tx) CheckRegularTransaction

func (tx *Tx) CheckRegularTransaction() error

func (*Tx) CheckStandard

func (tx *Tx) CheckStandard() error

func (*Tx) ComputePriority

func (tx *Tx) ComputePriority(priorityInputs float64, txSize int) float64

func (*Tx) Decode

func (tx *Tx) Decode(reader io.Reader) error

func (*Tx) Encode

func (tx *Tx) Encode(writer io.Writer) error

func (*Tx) EncodeSize

func (tx *Tx) EncodeSize() uint32

func (*Tx) GetAllPreviousOut

func (tx *Tx) GetAllPreviousOut() (outs []outpoint.OutPoint)

func (*Tx) GetHash

func (tx *Tx) GetHash() util.Hash

func (*Tx) GetIns

func (tx *Tx) GetIns() []*txin.TxIn

func (*Tx) GetInsCount

func (tx *Tx) GetInsCount() int

func (*Tx) GetLockTime

func (tx *Tx) GetLockTime() uint32

func (*Tx) GetOuts

func (tx *Tx) GetOuts() []*txout.TxOut

func (*Tx) GetOutsCount

func (tx *Tx) GetOutsCount() int

func (*Tx) GetSigOpCountWithoutP2SH

func (tx *Tx) GetSigOpCountWithoutP2SH() int

func (*Tx) GetTxIn

func (tx *Tx) GetTxIn(index int) (out *txin.TxIn)

func (*Tx) GetTxOut

func (tx *Tx) GetTxOut(index int) (out *txout.TxOut)

func (*Tx) GetValueOut

func (tx *Tx) GetValueOut() amount.Amount

func (*Tx) GetVersion

func (tx *Tx) GetVersion() int32

func (*Tx) IsCoinBase

func (tx *Tx) IsCoinBase() bool

func (*Tx) IsCommitment

func (tx *Tx) IsCommitment(data []byte) bool

func (*Tx) IsFinal

func (tx *Tx) IsFinal(Height int32, time int64) bool

IsFinal proceeds as follows 1. tx.locktime > 0 and tx.locktime < Threshhold, use height to check(tx.locktime > current height) 2. tx.locktime > Threshhold, use time to check(tx.locktime > current blocktime) 3. sequence can disable it

func (*Tx) RemoveTxIn

func (tx *Tx) RemoveTxIn(txIn *txin.TxIn)

func (*Tx) RemoveTxOut

func (tx *Tx) RemoveTxOut(txOut *txout.TxOut)

func (*Tx) Serialize

func (tx *Tx) Serialize(writer io.Writer) error

func (*Tx) SerializeSize

func (tx *Tx) SerializeSize() uint32

func (*Tx) SignStep

func (tx *Tx) SignStep(redeemScripts map[string]string, keys map[string]*crypto.PrivateKey,
	hashType uint32, scriptPubKey *script.Script, nIn int, value amount.Amount) (sigData [][]byte, pubKeyType int, err error)

func (*Tx) String

func (tx *Tx) String() string

func (*Tx) Unserialize

func (tx *Tx) Unserialize(reader io.Reader) error

func (*Tx) UpdateInScript

func (tx *Tx) UpdateInScript(i int, scriptSig *script.Script) error

Jump to

Keyboard shortcuts

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