tx

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: BSD-2-Clause Imports: 19 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) AnyInputTxIn added in v0.0.3

func (tx *Tx) AnyInputTxIn(container map[util.Hash]struct{}) bool

func (*Tx) CheckCoinbaseTransaction

func (tx *Tx) CheckCoinbaseTransaction() error

func (*Tx) CheckRegularTransaction

func (tx *Tx) CheckRegularTransaction() error

func (*Tx) CheckRegularTransactionWhenNewBlock added in v0.0.4

func (tx *Tx) CheckRegularTransactionWhenNewBlock(outPoints map[outpoint.OutPoint]bool) error

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(flags uint32) 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) InsertTxOut added in v0.0.3

func (tx *Tx) InsertTxOut(pos int, txOut *txout.TxOut)

func (*Tx) IsCoinBase

func (tx *Tx) IsCoinBase() bool

func (*Tx) IsFinal

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

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

func (*Tx) IsStandard added in v0.0.3

func (tx *Tx) IsStandard() (bool, string)

func (*Tx) PrevoutHashs added in v0.0.3

func (tx *Tx) PrevoutHashs() (outs []util.Hash)

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(nIn int, keyStore *crypto.KeyStore, redeemScript *script.Script, hashType uint32,
	scriptPubKey *script.Script, value amount.Amount) (sigData [][]byte, 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