types

package
v0.4.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: ISC Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	BurnBtcReward    = 1 << iota
	BurnJaxNetReward = 1 << iota
	BurnJaxReward    = 1 << iota
)
View Source
const (
	// MaxInvPerMsg is the maximum number of inventory vectors that can be in a
	// single bitcoin inv message.
	MaxInvPerMsg = 50000

	// MaxInvVectPayload is maximum payload size for an inventory vector.
	MaxInvVectPayload = 4 + chainhash.HashSize

	// InvWitnessFlag denotes that the inventory vector type is requesting,
	// or sending a version which includes witness data.
	InvWitnessFlag = 1 << 30
)
View Source
const JaxBurnAddr = "1JAXNETJAXNETJAXNETJAXNETJAXW3bkUN"

Variables

This section is empty.

Functions

This section is empty.

Types

type BloomUpdateType

type BloomUpdateType uint8

BloomUpdateType specifies how the filter is updated when a match is found

const (
	// BloomUpdateNone indicates the filter is not adjusted when a match is
	// found.
	BloomUpdateNone BloomUpdateType = 0

	// BloomUpdateAll indicates if the filter matches any data element in a
	// public key script, the outpoint is serialized and inserted into the
	// filter.
	BloomUpdateAll BloomUpdateType = 1

	// BloomUpdateP2PubkeyOnly indicates if the filter matches a data
	// element in a public key script and the script is of the standard
	// pay-to-pubkey or multisig, the outpoint is serialized and inserted
	// into the filter.
	BloomUpdateP2PubkeyOnly BloomUpdateType = 2
)

type InvType

type InvType uint32

InvType represents the allowed types of inventory vectors. See InvVect.

const (
	InvTypeError                InvType = 0
	InvTypeTx                   InvType = 1
	InvTypeBlock                InvType = 2
	InvTypeFilteredBlock        InvType = 3
	InvTypeWitnessBlock         InvType = InvTypeBlock | InvWitnessFlag
	InvTypeWitnessTx            InvType = InvTypeTx | InvWitnessFlag
	InvTypeFilteredWitnessBlock InvType = InvTypeFilteredBlock | InvWitnessFlag
)

These constants define the various supported inventory vector types.

func (InvType) String

func (invtype InvType) String() string

String returns the InvType in human-readable form.

type InvVect

type InvVect struct {
	Type InvType        // Type of data
	Hash chainhash.Hash // Hash of the data
}

InvVect defines a bitcoin inventory vector which is used to describe data, as specified by the Type field, that a server wants, has, or does not have to another server.

func NewInvVect

func NewInvVect(typ InvType, hash *chainhash.Hash) *InvVect

NewInvVect returns a new InvVect using the provided type and hash.

type JaxNet

type JaxNet uint32

JaxNet represents which JAX network a message belongs to.

const (
	// MainNet represents the main jax network.
	MainNet JaxNet = 0x6a_61_78_64

	// TestNet represents the test network.
	// TestNet JaxNet = 0x0709110b
	TestNet JaxNet = 0x76_6e_64_6d

	// SimNet represents the simulation test network.
	SimNet JaxNet = 0x12141c16

	// FastTestNet represents the development jax network.
	FastTestNet JaxNet = 0x12121212
)

Constants used to indicate the message bitcoin network. They can also be used to seek to the next message when a stream's state is unknown, but this package does not provide that functionality since it's generally a better idea to simply disconnect clients that are misbehaving over TCP.

func (JaxNet) String

func (n JaxNet) String() string

String returns the JaxNet in human-readable form.

type MessageError

type MessageError struct {
	Func        string // Function name
	Description string // Human readable description of the issue
}

MessageError describes an issue with a message. An example of some potential issues are messages from the wrong bitcoin network, invalid commands, mismatched checksums, and exceeding max payloads.

This provides a mechanism for the caller to type assert the error to differentiate between general io errors such as io.EOF and issues that resulted from malformed messages.

func Error

func Error(f string, desc string) *MessageError

messageError creates an error for the given function and description.

func (*MessageError) Error

func (e *MessageError) Error() string

Error satisfies the error interface and prints human-readable errors.

type RejectCode

type RejectCode uint8

RejectCode represents a numeric value by which a remote server indicates why a message was rejected.

const (
	RejectMalformed       RejectCode = 0x01
	RejectInvalid         RejectCode = 0x10
	RejectObsolete        RejectCode = 0x11
	RejectDuplicate       RejectCode = 0x12
	RejectNonstandard     RejectCode = 0x40
	RejectDust            RejectCode = 0x41
	RejectInsufficientFee RejectCode = 0x42
	RejectCheckpoint      RejectCode = 0x43
)

These constants define the various supported reject codes.

func (RejectCode) String

func (code RejectCode) String() string

String returns the RejectCode in human-readable form.

type ServiceFlag

type ServiceFlag uint64

ServiceFlag identifies services supported by a bitcoin server.

const (
	// SFNodeNetwork is a flag used to indicate a server is a full node.
	SFNodeNetwork ServiceFlag = 1 << iota

	// SFNodeGetUTXO is a flag used to indicate a server supports the
	// getutxos and utxos commands (BIP0064).
	SFNodeGetUTXO

	// SFNodeBloom is a flag used to indicate a server supports bloom
	// filtering.
	SFNodeBloom

	// SFNodeWitness is a flag used to indicate a server supports blocks
	// and transactions including witness data (BIP0144).
	SFNodeWitness

	// SFNodeXthin is a flag used to indicate a server supports xthin blocks.
	SFNodeXthin

	// SFNodeBit5 is a flag used to indicate a server supports a service
	// defined by bit 5.
	SFNodeBit5

	// SFNodeCF is a flag used to indicate a server supports committed
	// filters (CFs).
	SFNodeCF

	// SFNode2X is a flag used to indicate a server is running the Segwit2X
	// software.
	SFNode2X
)

func (ServiceFlag) String

func (f ServiceFlag) String() string

String returns the ServiceFlag in human-readable form.

type TimeSorter

type TimeSorter []int64

TimeSorter implements sort.Interface to allow a slice of timestamps to be sorted.

func (TimeSorter) Len

func (s TimeSorter) Len() int

Len returns the number of timestamps in the slice. It is part of the sort.Interface implementation.

func (TimeSorter) Less

func (s TimeSorter) Less(i, j int) bool

Less returns whether the timstamp with index i should sort before the timestamp with index j. It is part of the sort.Interface implementation.

func (TimeSorter) Swap

func (s TimeSorter) Swap(i, j int)

Swap swaps the timestamps at the passed indices. It is part of the sort.Interface implementation.

Directories

Path Synopsis
Package chaincfg defines chain configuration parameters.
Package chaincfg defines chain configuration parameters.
Package jaxjson provides primitives for working with the bitcoin JSON-RPC API.
Package jaxjson provides primitives for working with the bitcoin JSON-RPC API.
Package wire implements the bitcoin wire protocol.
Package wire implements the bitcoin wire protocol.

Jump to

Keyboard shortcuts

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