Documentation
¶
Index ¶
- Constants
- Variables
- func AssetDetailFromBytes(asset []byte) (uint32, uint32, uint32)
- func WriteMessage(w io.Writer, msg Message, pver uint32) error
- func WriteMessageN(w io.Writer, msg Message, pver uint32) (int, error)
- func WriteMessageWithEncodingN(w io.Writer, msg Message, pver uint32, encoding MessageEncoding) (int, error)
- type Asset
- type BlockHeader
- type BlockSignList
- type BloomUpdateType
- type FilterType
- type InvType
- type InvVect
- type Message
- type MessageEncoding
- type MessageError
- type MsgAddr
- func (msg *MsgAddr) AddAddress(na *NetAddress) error
- func (msg *MsgAddr) AddAddresses(netAddrs ...*NetAddress) error
- func (msg *MsgAddr) ClearAddresses()
- func (msg *MsgAddr) Command() string
- func (msg *MsgAddr) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgAddr) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgAddr) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type MsgBlock
- func (msg *MsgBlock) AddTransaction(tx *MsgTx)
- func (msg *MsgBlock) BlockHash() common.Hash
- func (msg *MsgBlock) CalculatePoaHash() common.Hash
- func (msg *MsgBlock) ClearTransactions()
- func (msg *MsgBlock) Command() string
- func (msg *MsgBlock) Deserialize(r io.Reader) error
- func (msg *MsgBlock) DeserializeTxLoc(r *bytes.Buffer) ([]TxLoc, error)
- func (msg *MsgBlock) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgBlock) Serialize(w io.Writer) error
- func (msg *MsgBlock) SerializeSize() int
- func (msg *MsgBlock) TxHashes() ([]common.Hash, error)
- func (msg *MsgBlock) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgBlock) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type MsgBlockSign
- func (bs *MsgBlockSign) Command() string
- func (bs *MsgBlockSign) Deserialize(r io.Reader) error
- func (bs *MsgBlockSign) MaxPayloadLength(uint32) uint32
- func (bs *MsgBlockSign) Serialize(w io.Writer) error
- func (bs *MsgBlockSign) SerializeSize() int
- func (bs *MsgBlockSign) SignHash() common.Hash
- func (bs *MsgBlockSign) VVSDecode(r io.Reader, pver uint32, me MessageEncoding) error
- func (bs *MsgBlockSign) VVSEncode(w io.Writer, pver uint32, me MessageEncoding) error
- type MsgCFCheckpt
- func (msg *MsgCFCheckpt) AddCFHeader(header *common.Hash) error
- func (msg *MsgCFCheckpt) Command() string
- func (msg *MsgCFCheckpt) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgCFCheckpt) VVSDecode(r io.Reader, pver uint32, _ MessageEncoding) error
- func (msg *MsgCFCheckpt) VVSEncode(w io.Writer, pver uint32, _ MessageEncoding) error
- type MsgCFHeaders
- func (msg *MsgCFHeaders) AddCFHash(hash *common.Hash) error
- func (msg *MsgCFHeaders) Command() string
- func (msg *MsgCFHeaders) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgCFHeaders) VVSDecode(r io.Reader, pver uint32, _ MessageEncoding) error
- func (msg *MsgCFHeaders) VVSEncode(w io.Writer, pver uint32, _ MessageEncoding) error
- type MsgCFilter
- type MsgFeeFilter
- type MsgFilterAdd
- type MsgFilterClear
- type MsgFilterLoad
- type MsgGetAddr
- type MsgGetBlocks
- func (msg *MsgGetBlocks) AddBlockLocatorHash(hash *common.Hash) error
- func (msg *MsgGetBlocks) Command() string
- func (msg *MsgGetBlocks) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgGetBlocks) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgGetBlocks) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type MsgGetCFCheckpt
- type MsgGetCFHeaders
- type MsgGetCFilters
- type MsgGetData
- func (msg *MsgGetData) AddInvVect(iv *InvVect) error
- func (msg *MsgGetData) Command() string
- func (msg *MsgGetData) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgGetData) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgGetData) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type MsgGetHeaders
- func (msg *MsgGetHeaders) AddBlockLocatorHash(hash *common.Hash) error
- func (msg *MsgGetHeaders) Command() string
- func (msg *MsgGetHeaders) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgGetHeaders) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgGetHeaders) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type MsgHeaders
- func (msg *MsgHeaders) AddBlockHeader(bh *BlockHeader) error
- func (msg *MsgHeaders) Command() string
- func (msg *MsgHeaders) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgHeaders) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgHeaders) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type MsgInv
- func (msg *MsgInv) AddInvVect(iv *InvVect) error
- func (msg *MsgInv) Command() string
- func (msg *MsgInv) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgInv) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgInv) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type MsgMemPool
- type MsgMerkleBlock
- func (msg *MsgMerkleBlock) AddTxHash(hash *common.Hash) error
- func (msg *MsgMerkleBlock) Command() string
- func (msg *MsgMerkleBlock) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgMerkleBlock) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgMerkleBlock) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type MsgNotFound
- func (msg *MsgNotFound) AddInvVect(iv *InvVect) error
- func (msg *MsgNotFound) Command() string
- func (msg *MsgNotFound) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgNotFound) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgNotFound) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type MsgPing
- type MsgPong
- type MsgReject
- type MsgSendHeaders
- type MsgTx
- func (msg *MsgTx) AddTxIn(ti *TxIn)
- func (msg *MsgTx) AddTxOut(to *TxOut)
- func (msg *MsgTx) Command() string
- func (msg *MsgTx) Copy() *MsgTx
- func (msg *MsgTx) DataLoc() int
- func (msg *MsgTx) Deserialize(r io.Reader) error
- func (msg *MsgTx) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgTx) PkScriptLocs() []int
- func (msg *MsgTx) Serialize(w io.Writer) error
- func (msg *MsgTx) SerializeSize() int
- func (msg *MsgTx) SetTxContract(tc *TxContract)
- func (msg *MsgTx) String() string
- func (msg *MsgTx) TransactionHash() common.Hash
- func (msg *MsgTx) TxHash() common.Hash
- func (msg *MsgTx) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgTx) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type MsgVBlock
- type MsgVerAck
- type MsgVersion
- func (msg *MsgVersion) AddService(service common.ServiceFlag)
- func (msg *MsgVersion) AddUserAgent(name string, version string, comments ...string) error
- func (msg *MsgVersion) Command() string
- func (msg *MsgVersion) HasService(service common.ServiceFlag) bool
- func (msg *MsgVersion) MaxPayloadLength(pver uint32) uint32
- func (msg *MsgVersion) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
- func (msg *MsgVersion) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
- type NetAddress
- type OutPoint
- type RejectCode
- type TxContract
- type TxIn
- type TxLoc
- type TxOut
Constants ¶
const ( // max sign len HashSignLen = 65 // BlockHeaderPayload is the number of bytes a block header can be. // blockHeaderFixedPayload + SigData BlockHeaderPayload = blockHeaderFixedPayload + HashSignLen )
const ( CmdVersion = "version" CmdVerAck = "verack" CmdGetAddr = "getaddr" CmdAddr = "addr" CmdGetBlocks = "getblocks" CmdInv = "inv" CmdGetData = "getdata" CmdNotFound = "notfound" CmdBlock = "block" CmdTx = "tx" CmdSig = "sig" CmdGetHeaders = "getheaders" CmdHeaders = "headers" CmdPing = "ping" CmdPong = "pong" CmdMemPool = "mempool" CmdFilterAdd = "filteradd" CmdFilterClear = "filterclear" CmdFilterLoad = "filterload" CmdMerkleBlock = "merkleblock" CmdReject = "reject" CmdSendHeaders = "sendheaders" CmdFeeFilter = "feefilter" CmdGetCFilters = "getcfilters" CmdGetCFHeaders = "getcfheaders" CmdGetCFCheckpt = "getcfcheckpt" CmdCFilter = "cfilter" CmdCFHeaders = "cfheaders" CmdCFCheckpt = "cfcheckpt" )
Commands used in bitcoin message headers which describe the type of message.
const ( // MaxCFHeaderPayload is the maximum byte size of a committed // filter header. MaxCFHeaderPayload = common.HashLength // MaxCFHeadersPerMsg is the maximum number of committed filter headers // that can be in a single bitcoin cfheaders message. MaxCFHeadersPerMsg = 2000 )
const ( // MaxFilterLoadHashFuncs is the maximum number of hash functions to // load into the Bloom filter. MaxFilterLoadHashFuncs = 50 // MaxFilterLoadFilterSize is the maximum size in bytes a filter may be. MaxFilterLoadFilterSize = 36000 )
const ( // TxVersion is the current latest supported transaction version. TxVersion = 1 // MaxTxInSequenceNum is the maximum sequence number the sequence field // of a transaction input can be. MaxTxInSequenceNum uint32 = 0xffffffff // MaxPrevOutIndex is the maximum index the index field of a previous // outpoint can be. MaxPrevOutIndex uint32 = 0xffffffff // SequenceLockTimeDisabled is a flag that if set on a transaction // input's sequence number, the sequence number will not be interpreted // as a relative lock time. SequenceLockTimeDisabled = 1 << 31 // SequenceLockTimeIsSeconds is a flag that if set on a transaction // input's sequence number, the relative locktime has units of 512 // seconds. SequenceLockTimeIsSeconds = 1 << 22 // SequenceLockTimeMask is a mask that extracts the relative locktime // when masked against the transaction input sequence number. SequenceLockTimeMask = 0x0000ffff // SequenceLockTimeGranularity is the defined time based granularity // for seconds-based relative time locks. When converting from seconds // to a sequence number, the value is right shifted by this amount, // therefore the granularity of relative time locks in 512 or 2^9 // seconds. Enforced relative lock times are multiples of 512 seconds. SequenceLockTimeGranularity = 9 // MaxTxInPerMessage is the maximum number of transactions inputs that // a transaction which fits into a message could possibly have. MaxTxInPerMessage = MaxMessagePayload / minTxInPayload // MaxTxOutPerMessage is the maximum number of transactions outputs that // a transaction which fits into a message could possibly have. MaxTxOutPerMessage = MaxMessagePayload / minTxOutPayload // DivisibleAsset is the default divisible property of asimov coin DivisibleAsset uint32 = 0 // DefaultCoinId is the default coin id of asimov coin DefaultCoinId uint32 = 0 // DefaultOrgId is the default organization id of asimov coin DefaultOrgId uint32 = 0 )
const ( // CFCheckPTInterval is the gap (in number of blocks) between each // filter header checkpoint. CFCheckPTInterval = 1000 )
const DefaultUserAgent = "/asimovproto:0.0.1/"
DefaultUserAgent for protos in the stack
const (
InDivisibleAsset = 1 << iota
)
const MaxAddrPerMsg = 1000
MaxAddrPerMsg is the maximum number of addresses that can be in a single bitcoin addr message (MsgAddr).
const MaxBlockHeadersPerMsg = 2000
MaxBlockHeadersPerMsg is the maximum number of block headers that can be in a single bitcoin headers message.
const MaxBlockLocatorsPerMsg = 500
MaxBlockLocatorsPerMsg is the maximum number of block locator hashes allowed per message.
const MaxBlockPayload = common.MaxBlockSize
MaxBlockPayload is the maximum bytes a block message can be in bytes.
const MaxBlocksPerMsg = 500
MaxBlocksPerMsg is the maximum number of blocks allowed per message.
const ( // MaxCFilterDataSize is the maximum byte size of a committed filter. // The maximum size is currently defined as 256KiB. MaxCFilterDataSize = 256 * 1024 )
const ( // MaxFilterAddDataSize is the maximum byte size of a data // element to add to the Bloom filter. It is equal to the // maximum element size of a script. MaxFilterAddDataSize = 520 )
const MaxGetCFiltersReqRange = 1000
MaxGetCFiltersReqRange the maximum number of filters that may be requested in a getcfheaders message.
const ( // MaxInvPerMsg is the maximum number of inventory vectors that can be in a // single bitcoin inv message. MaxInvPerMsg = 50000 )
const MaxMessagePayload = 1024 * 1024 * 2 // 2MB
MaxMessagePayload is the maximum bytes a message can be regardless of other individual limits imposed by messages themselves.
const MaxPongPayloadLen = 8
const MaxUserAgentLen = 256
MaxUserAgentLen is the maximum allowed length for the user agent field in a version message (MsgVersion).
const MessageHeaderSize = 20
MessageHeaderSize is the number of bytes in a bitcoin message header. command 12 bytes + payload length 4 bytes + checksum 4 bytes.
Variables ¶
var ErrInsaneCFHeaderCount = errors.New("refusing to decode unreasonable number of filter headers")
ErrInsaneCFHeaderCount signals that we were asked to decode an unreasonable number of cfilter headers.
var LatestEncoding = BaseEncoding
LatestEncoding is the most recently specified encoding for the Bitcoin protos protocol.
Functions ¶
func AssetDetailFromBytes ¶
AssetDetailFromBytes transfers byte asset to asset detail
func WriteMessage ¶
WriteMessage writes a bitcoin Message to w including the necessary header information. This function is the same as WriteMessageN except it doesn't doesn't return the number of bytes written. This function is mainly provided for backwards compatibility with the original API, but it's also useful for callers that don't care about byte counts.
func WriteMessageN ¶
WriteMessageN writes a bitcoin Message to w including the necessary header information and returns the number of bytes written. This function is the same as WriteMessage except it also returns the number of bytes written.
func WriteMessageWithEncodingN ¶
func WriteMessageWithEncodingN(w io.Writer, msg Message, pver uint32, encoding MessageEncoding) (int, error)
WriteMessageWithEncodingN writes a bitcoin Message to w including the necessary header information and returns the number of bytes written. This function is the same as WriteMessageN except it also allows the caller to specify the message encoding format to be used when serializing protos messages.
Types ¶
type Asset ¶
Asset defines an asimov data type that is used to distinguish different asset. Property: represents asset property. Currently 0th bit represents
divisible or not (1 indivisible), the first bit of the second byte represents votable or not (1 votable);
Id:[0-4) bytes represents the organization which creates this asset;
[4-8) bytes unique id distinguish different asset in the organization.
func AssetFromBytes ¶
AssetFromBytes transfers byte asset to property asset
func AssetFromInt ¶
AssetFromInt returns struct of Asset from the given value
func (*Asset) AssetFields ¶
assetFields returns three parts of an asset. property + orgId + coinId
func (*Asset) FixedBytes ¶
func (a *Asset) FixedBytes() [common.AssetLength]byte
FixedBytes returns an asset with type of byte array
func (*Asset) IsIndivisible ¶
IsIndivisible returns an asset is divisible or indivisible
type BlockHeader ¶
type BlockHeader struct { // Version of the block. This is not the same as the protocol version. Version int32 // Hash of the previous block header in the block chain. PrevBlock common.Hash // Merkle tree reference to hash of all transactions for the block. MerkleRoot common.Hash // Time the block was created. Timestamp int64 // VM fields StateRoot common.Hash GasLimit uint64 GasUsed uint64 // Consensus fields Round uint32 SlotIndex uint16 // The weight of block, it is the sum of all weight of signatures. Weight uint16 // Hash of ReceiptHash Bloom and PreBlockSigs PoaHash common.Hash Height int32 CoinBase common.Address SigData [HashSignLen]byte }
BlockHeader defines information about a block and is used in the asimov block (MsgBlock) and headers (MsgHeaders) messages.
func NewBlockHeader ¶
func NewBlockHeader(version int32, prevHash *common.Hash) *BlockHeader
NewBlockHeader returns a new BlockHeader using the provided version, previous block hash, merkle root hash, difficulty bits, and nonce used to generate the block with defaults for the remaining fields.
func (*BlockHeader) BlockHash ¶
func (bh *BlockHeader) BlockHash() common.Hash
BlockHash computes the block identifier hash for the given block header.
func (*BlockHeader) Deserialize ¶
func (bh *BlockHeader) Deserialize(r io.Reader) error
Deserialize decodes a block header from r into the receiver using a format that is suitable for long-term storage such as a database while respecting the Version field.
func (*BlockHeader) Serialize ¶
func (bh *BlockHeader) Serialize(w io.Writer) error
Serialize encodes a block header from w into the receiver using a format that is suitable for long-term storage such as a database while respecting the Version field.
func (*BlockHeader) SerializeNode ¶
func (bh *BlockHeader) SerializeNode(w io.Writer) error
SerializeNode encodes BlockHeader to w using the asimov protocol encoding.
type BlockSignList ¶
type BlockSignList []*MsgBlockSign
MsgBlockSign records the information of signer who signs for block
func (BlockSignList) Len ¶
func (bl BlockSignList) Len() int
/ Len returns the number of signers sign for block
func (BlockSignList) Less ¶
func (bl BlockSignList) Less(i, j int) bool
func (BlockSignList) Swap ¶
func (bl BlockSignList) Swap(i, j int)
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 FilterType ¶
type FilterType uint8
FilterType is used to represent a filter type.
const ( // GCSFilterRegular is the regular filter type. GCSFilterRegular FilterType = iota )
type InvType ¶
type InvType uint32
InvType represents the allowed types of inventory vectors. See InvVect.
type InvVect ¶
InvVect defines a bitcoin inventory vector which is used to describe data, as specified by the Type field, that a peer wants, has, or does not have to another peer.
type Message ¶
type Message interface { VVSDecode(io.Reader, uint32, MessageEncoding) error VVSEncode(io.Writer, uint32, MessageEncoding) error Command() string MaxPayloadLength(uint32) uint32 }
Message is an interface that describes a bitcoin message. A type that implements Message has complete control over the representation of its data and may therefore contain additional or fewer fields than those which are used directly in the protocol encoded message.
func ReadMessage ¶
ReadMessage reads, validates, and parses the next bitcoin Message from r for the provided protocol version and bitcoin network. It returns the parsed Message and raw bytes which comprise the message. This function only differs from ReadMessageN in that it doesn't return the number of bytes read. This function is mainly provided for backwards compatibility with the original API, but it's also useful for callers that don't care about byte counts.
func ReadMessageN ¶
ReadMessageN reads, validates, and parses the next bitcoin Message from r for the provided protocol version and bitcoin network. It returns the number of bytes read in addition to the parsed Message and raw bytes which comprise the message. This function is the same as ReadMessage except it also returns the number of bytes read.
func ReadMessageWithEncodingN ¶
func ReadMessageWithEncodingN(r io.Reader, pver uint32, enc MessageEncoding) (int, Message, []byte, error)
ReadMessageWithEncodingN reads, validates, and parses the next bitcoin Message from r for the provided protocol version and bitcoin network. It returns the number of bytes read in addition to the parsed Message and raw bytes which comprise the message. This function is the same as ReadMessageN except it allows the caller to specify which message encoding is to to consult when decoding protos messages.
type MessageEncoding ¶
type MessageEncoding uint32
MessageEncoding represents the protos message encoding format to be used.
const ( // BaseEncoding encodes all messages in the default format specified // for the Bitcoin protos protocol. BaseEncoding MessageEncoding = 1 << iota )
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 (*MessageError) Error ¶
func (e *MessageError) Error() string
Error satisfies the error interface and prints human-readable errors.
type MsgAddr ¶
type MsgAddr struct {
AddrList []*NetAddress
}
MsgAddr implements the Message interface and represents a bitcoin addr message. It is used to provide a list of known active peers on the network. An active peer is considered one that has transmitted a message within the last 3 hours. Nodes which have not transmitted in that time frame should be forgotten. Each message is limited to a maximum number of addresses, which is currently 1000. As a result, multiple messages must be used to relay the full list.
Use the AddAddress function to build up the list of known addresses when sending an addr message to another peer.
func NewMsgAddr ¶
func NewMsgAddr() *MsgAddr
NewMsgAddr returns a new bitcoin addr message that conforms to the Message interface. See MsgAddr for details.
func (*MsgAddr) AddAddress ¶
func (msg *MsgAddr) AddAddress(na *NetAddress) error
AddAddress adds a known active peer to the message.
func (*MsgAddr) AddAddresses ¶
func (msg *MsgAddr) AddAddresses(netAddrs ...*NetAddress) error
AddAddresses adds multiple known active peers to the message.
func (*MsgAddr) ClearAddresses ¶
func (msg *MsgAddr) ClearAddresses()
ClearAddresses removes all addresses from the message.
func (*MsgAddr) Command ¶
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgAddr) MaxPayloadLength ¶
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
type MsgBlock ¶
type MsgBlock struct { Header BlockHeader ReceiptHash common.Hash Bloom types.Bloom Transactions []*MsgTx PreBlockSigs BlockSignList // collect signatures for ancestors }
MsgBlock implements the Message interface and represents a bitcoin block message. It is used to deliver block and transaction information in response to a getdata message (MsgGetData) for a given block hash.
func NewMsgBlock ¶
func NewMsgBlock(blockHeader *BlockHeader) *MsgBlock
NewMsgBlock returns a new bitcoin block message that conforms to the Message interface. See MsgBlock for details.
func (*MsgBlock) AddTransaction ¶
AddTransaction adds a transaction to the message.
func (*MsgBlock) CalculatePoaHash ¶
CalculatePoaHash returns hash value from MsgBlock when run with poa
func (*MsgBlock) ClearTransactions ¶
func (msg *MsgBlock) ClearTransactions()
ClearTransactions removes all transactions from the message.
func (*MsgBlock) Command ¶
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgBlock) Deserialize ¶
Deserialize decodes a block from r into the receiver using a format that is suitable for long-term storage such as a database while respecting the Version field in the block. This function differs from VVSDecode in that VVSDecode decodes from the bitcoin protos protocol as it was sent across the network. The protos encoding can technically differ depending on the protocol version and doesn't even really need to match the format of a stored block at all. As of the time this comment was written, the encoded block is the same in both instances, but there is a distinct difference and separating the two allows the API to be flexible enough to deal with changes.
func (*MsgBlock) DeserializeTxLoc ¶
DeserializeTxLoc decodes r in the same manner Deserialize does, but it takes a byte buffer instead of a generic reader and returns a slice containing the start and length of each transaction within the raw data that is being deserialized.
func (*MsgBlock) MaxPayloadLength ¶
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgBlock) Serialize ¶
Serialize encodes the block to w using a format that suitable for long-term storage such as a database while respecting the Version field in the block. This function differs from VVSEncode in that VVSEncode encodes the block to the bitcoin protos protocol in order to be sent across the network. The protos encoding can technically differ depending on the protocol version and doesn't even really need to match the format of a stored block at all. As of the time this comment was written, the encoded block is the same in both instances, but there is a distinct difference and separating the two allows the API to be flexible enough to deal with changes.
func (*MsgBlock) SerializeSize ¶
SerializeSize returns the number of bytes it would take to serialize the block, factoring in any witness data within transaction.
func (*MsgBlock) TxHashes ¶
TxHashes returns a slice of hashes of all of transactions in this block.
func (*MsgBlock) VVSDecode ¶
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation. See Deserialize for decoding blocks stored to disk, such as in a database, as opposed to decoding blocks from the protos.
type MsgBlockSign ¶
type MsgBlockSign struct { BlockHeight int32 BlockHash common.Hash Signer common.Address Signature [HashSignLen]byte }
MsgBlockSign describes relationship between block and signer signer signs for the block and ensures the block is valid
func (*MsgBlockSign) Command ¶
func (bs *MsgBlockSign) Command() string
func (*MsgBlockSign) Deserialize ¶
func (bs *MsgBlockSign) Deserialize(r io.Reader) error
Deserialize decodes MsgBlockSign from r into the receiver using a format that is suitable for long-term storage such as a database while respecting the Version field.
func (*MsgBlockSign) MaxPayloadLength ¶
func (bs *MsgBlockSign) MaxPayloadLength(uint32) uint32
func (*MsgBlockSign) Serialize ¶
func (bs *MsgBlockSign) Serialize(w io.Writer) error
Serialize encodes MsgBlockSign to w using the asimov protocol encoding.
func (*MsgBlockSign) SerializeSize ¶
func (bs *MsgBlockSign) SerializeSize() int
SerializeSize returns length of block sign payload
func (*MsgBlockSign) SignHash ¶
func (bs *MsgBlockSign) SignHash() common.Hash
SignHash generates the Hash for the block sign.
func (*MsgBlockSign) VVSDecode ¶
func (bs *MsgBlockSign) VVSDecode(r io.Reader, pver uint32, me MessageEncoding) error
VVSDecode decodes MsgBlockSign from r into the receiver using a format // that is suitable for long-term storage such as a database while respecting // the Version field.
func (*MsgBlockSign) VVSEncode ¶
func (bs *MsgBlockSign) VVSEncode(w io.Writer, pver uint32, me MessageEncoding) error
VVSEncode encodes MsgBlockSign to w using the asimov protocol encoding
type MsgCFCheckpt ¶
type MsgCFCheckpt struct { FilterType FilterType StopHash common.Hash FilterHeaders []*common.Hash }
MsgCFCheckpt implements the Message interface and represents a bitcoin cfcheckpt message. It is used to deliver committed filter header information in response to a getcfcheckpt message (MsgGetCFCheckpt). See MsgGetCFCheckpt for details on requesting the headers.
func NewMsgCFCheckpt ¶
func NewMsgCFCheckpt(filterType FilterType, stopHash *common.Hash, headersCount int) *MsgCFCheckpt
NewMsgCFCheckpt returns a new bitcoin cfheaders message that conforms to the Message interface. See MsgCFCheckpt for details.
func (*MsgCFCheckpt) AddCFHeader ¶
func (msg *MsgCFCheckpt) AddCFHeader(header *common.Hash) error
AddCFHeader adds a new committed filter header to the message.
func (*MsgCFCheckpt) Command ¶
func (msg *MsgCFCheckpt) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgCFCheckpt) MaxPayloadLength ¶
func (msg *MsgCFCheckpt) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgCFCheckpt) VVSDecode ¶
func (msg *MsgCFCheckpt) VVSDecode(r io.Reader, pver uint32, _ MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgCFCheckpt) VVSEncode ¶
func (msg *MsgCFCheckpt) VVSEncode(w io.Writer, pver uint32, _ MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgCFHeaders ¶
type MsgCFHeaders struct { FilterType FilterType StopHash common.Hash PrevFilterHeader common.Hash FilterHashes []*common.Hash }
MsgCFHeaders implements the Message interface and represents a bitcoin cfheaders message. It is used to deliver committed filter header information in response to a getcfheaders message (MsgGetCFHeaders). The maximum number of committed filter headers per message is currently 2000. See MsgGetCFHeaders for details on requesting the headers.
func NewMsgCFHeaders ¶
func NewMsgCFHeaders() *MsgCFHeaders
NewMsgCFHeaders returns a new bitcoin cfheaders message that conforms to the Message interface. See MsgCFHeaders for details.
func (*MsgCFHeaders) AddCFHash ¶
func (msg *MsgCFHeaders) AddCFHash(hash *common.Hash) error
AddCFHash adds a new filter hash to the message.
func (*MsgCFHeaders) Command ¶
func (msg *MsgCFHeaders) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgCFHeaders) MaxPayloadLength ¶
func (msg *MsgCFHeaders) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgCFHeaders) VVSDecode ¶
func (msg *MsgCFHeaders) VVSDecode(r io.Reader, pver uint32, _ MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgCFHeaders) VVSEncode ¶
func (msg *MsgCFHeaders) VVSEncode(w io.Writer, pver uint32, _ MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgCFilter ¶
type MsgCFilter struct { FilterType FilterType BlockHash common.Hash Data []byte }
MsgCFilter implements the Message interface and represents a bitcoin cfilter message. It is used to deliver a committed filter in response to a getcfilters (MsgGetCFilters) message.
func NewMsgCFilter ¶
func NewMsgCFilter(filterType FilterType, blockHash *common.Hash, data []byte) *MsgCFilter
NewMsgCFilter returns a new bitcoin cfilter message that conforms to the Message interface. See MsgCFilter for details.
func (*MsgCFilter) Command ¶
func (msg *MsgCFilter) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgCFilter) MaxPayloadLength ¶
func (msg *MsgCFilter) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgCFilter) VVSDecode ¶
func (msg *MsgCFilter) VVSDecode(r io.Reader, pver uint32, _ MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgCFilter) VVSEncode ¶
func (msg *MsgCFilter) VVSEncode(w io.Writer, pver uint32, _ MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgFeeFilter ¶
type MsgFeeFilter struct {
MinPrice int32
}
MsgFeeFilter implements the Message interface and represents a bitcoin feeFilter message. It is used to request the receiving peer does not announce any transactions below the specified minimum fee rate.
This message was not added until protocol versions starting with FeeFilterVersion.
func NewMsgFeeFilter ¶
func NewMsgFeeFilter(minPrice int32) *MsgFeeFilter
NewMsgFeeFilter returns a new bitcoin feeFilter message that conforms to the Message interface. See MsgFeeFilter for details.
func (*MsgFeeFilter) Command ¶
func (msg *MsgFeeFilter) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgFeeFilter) MaxPayloadLength ¶
func (msg *MsgFeeFilter) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgFeeFilter) VVSDecode ¶
func (msg *MsgFeeFilter) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgFeeFilter) VVSEncode ¶
func (msg *MsgFeeFilter) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgFilterAdd ¶
type MsgFilterAdd struct {
Data []byte
}
MsgFilterAdd implements the Message interface and represents a bitcoin filterAdd message. It is used to add a data element to an existing Bloom filter.
This message was not added until protocol version BIP0037Version.
func NewMsgFilterAdd ¶
func NewMsgFilterAdd(data []byte) *MsgFilterAdd
NewMsgFilterAdd returns a new bitcoin filterAdd message that conforms to the Message interface. See MsgFilterAdd for details.
func (*MsgFilterAdd) Command ¶
func (msg *MsgFilterAdd) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgFilterAdd) MaxPayloadLength ¶
func (msg *MsgFilterAdd) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgFilterAdd) VVSDecode ¶
func (msg *MsgFilterAdd) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgFilterAdd) VVSEncode ¶
func (msg *MsgFilterAdd) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgFilterClear ¶
type MsgFilterClear struct{}
MsgFilterClear implements the Message interface and represents a bitcoin filterClear message which is used to reset a Bloom filter.
This message was not added until protocol version BIP0037Version and has no payload.
func NewMsgFilterClear ¶
func NewMsgFilterClear() *MsgFilterClear
NewMsgFilterClear returns a new bitcoin filterClear message that conforms to the Message interface. See MsgFilterClear for details.
func (*MsgFilterClear) Command ¶
func (msg *MsgFilterClear) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgFilterClear) MaxPayloadLength ¶
func (msg *MsgFilterClear) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgFilterClear) VVSDecode ¶
func (msg *MsgFilterClear) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgFilterClear) VVSEncode ¶
func (msg *MsgFilterClear) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgFilterLoad ¶
type MsgFilterLoad struct { Filter []byte HashFuncs uint32 Tweak uint32 Flags BloomUpdateType }
MsgFilterLoad implements the Message interface and represents a bitcoin filterload message which is used to reset a Bloom filter.
This message was not added until protocol version BIP0037Version.
func NewMsgFilterLoad ¶
func NewMsgFilterLoad(filter []byte, hashFuncs uint32, tweak uint32, flags BloomUpdateType) *MsgFilterLoad
NewMsgFilterLoad returns a new bitcoin filterload message that conforms to the Message interface. See MsgFilterLoad for details.
func (*MsgFilterLoad) Command ¶
func (msg *MsgFilterLoad) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgFilterLoad) MaxPayloadLength ¶
func (msg *MsgFilterLoad) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgFilterLoad) VVSDecode ¶
func (msg *MsgFilterLoad) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgFilterLoad) VVSEncode ¶
func (msg *MsgFilterLoad) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgGetAddr ¶
type MsgGetAddr struct{}
MsgGetAddr implements the Message interface and represents a bitcoin getaddr message. It is used to request a list of known active peers on the network from a peer to help identify potential nodes. The list is returned via one or more addr messages (MsgAddr).
This message has no payload.
func NewMsgGetAddr ¶
func NewMsgGetAddr() *MsgGetAddr
NewMsgGetAddr returns a new bitcoin getaddr message that conforms to the Message interface. See MsgGetAddr for details.
func (*MsgGetAddr) Command ¶
func (msg *MsgGetAddr) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgGetAddr) MaxPayloadLength ¶
func (msg *MsgGetAddr) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgGetAddr) VVSDecode ¶
func (msg *MsgGetAddr) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgGetAddr) VVSEncode ¶
func (msg *MsgGetAddr) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgGetBlocks ¶
type MsgGetBlocks struct { ProtocolVersion uint32 BlockLocatorHashes []*common.Hash HashStop common.Hash }
MsgGetBlocks implements the Message interface and represents a bitcoin getblocks message. It is used to request a list of blocks starting after the last known hash in the slice of block locator hashes. The list is returned via an inv message (MsgInv) and is limited by a specific hash to stop at or the maximum number of blocks per message, which is currently 500.
Set the HashStop field to the hash at which to stop and use AddBlockLocatorHash to build up the list of block locator hashes.
The algorithm for building the block locator hashes should be to add the hashes in reverse order until you reach the genesis block. In order to keep the list of locator hashes to a reasonable number of entries, first add the most recent 10 block hashes, then double the step each loop iteration to exponentially decrease the number of hashes the further away from head and closer to the genesis block you get.
func NewMsgGetBlocks ¶
func NewMsgGetBlocks(hashStop *common.Hash) *MsgGetBlocks
NewMsgGetBlocks returns a new bitcoin getblocks message that conforms to the Message interface using the passed parameters and defaults for the remaining fields.
func (*MsgGetBlocks) AddBlockLocatorHash ¶
func (msg *MsgGetBlocks) AddBlockLocatorHash(hash *common.Hash) error
AddBlockLocatorHash adds a new block locator hash to the message.
func (*MsgGetBlocks) Command ¶
func (msg *MsgGetBlocks) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgGetBlocks) MaxPayloadLength ¶
func (msg *MsgGetBlocks) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgGetBlocks) VVSDecode ¶
func (msg *MsgGetBlocks) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgGetBlocks) VVSEncode ¶
func (msg *MsgGetBlocks) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgGetCFCheckpt ¶
type MsgGetCFCheckpt struct { FilterType FilterType StopHash common.Hash }
MsgGetCFCheckpt is a request for filter headers at evenly spaced intervals throughout the blockchain history. It allows to set the FilterType field to get headers in the chain of basic (0x00) or extended (0x01) headers.
func NewMsgGetCFCheckpt ¶
func NewMsgGetCFCheckpt(filterType FilterType, stopHash *common.Hash) *MsgGetCFCheckpt
NewMsgGetCFCheckpt returns a new bitcoin getcfcheckpt message that conforms to the Message interface using the passed parameters and defaults for the remaining fields.
func (*MsgGetCFCheckpt) Command ¶
func (msg *MsgGetCFCheckpt) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgGetCFCheckpt) MaxPayloadLength ¶
func (msg *MsgGetCFCheckpt) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgGetCFCheckpt) VVSDecode ¶
func (msg *MsgGetCFCheckpt) VVSDecode(r io.Reader, pver uint32, _ MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgGetCFCheckpt) VVSEncode ¶
func (msg *MsgGetCFCheckpt) VVSEncode(w io.Writer, pver uint32, _ MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgGetCFHeaders ¶
type MsgGetCFHeaders struct { FilterType FilterType StartHeight uint32 StopHash common.Hash }
MsgGetCFHeaders is a message similar to MsgGetHeaders, but for committed filter headers. It allows to set the FilterType field to get headers in the chain of basic (0x00) or extended (0x01) headers.
func NewMsgGetCFHeaders ¶
func NewMsgGetCFHeaders(filterType FilterType, startHeight uint32, stopHash *common.Hash) *MsgGetCFHeaders
NewMsgGetCFHeaders returns a new bitcoin getcfheader message that conforms to the Message interface using the passed parameters and defaults for the remaining fields.
func (*MsgGetCFHeaders) Command ¶
func (msg *MsgGetCFHeaders) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgGetCFHeaders) MaxPayloadLength ¶
func (msg *MsgGetCFHeaders) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgGetCFHeaders) VVSDecode ¶
func (msg *MsgGetCFHeaders) VVSDecode(r io.Reader, pver uint32, _ MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgGetCFHeaders) VVSEncode ¶
func (msg *MsgGetCFHeaders) VVSEncode(w io.Writer, pver uint32, _ MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgGetCFilters ¶
type MsgGetCFilters struct { FilterType FilterType StartHeight uint32 StopHash common.Hash }
MsgGetCFilters implements the Message interface and represents a bitcoin getcfilters message. It is used to request committed filters for a range of blocks.
func NewMsgGetCFilters ¶
func NewMsgGetCFilters(filterType FilterType, startHeight uint32, stopHash *common.Hash) *MsgGetCFilters
NewMsgGetCFilters returns a new bitcoin getcfilters message that conforms to the Message interface using the passed parameters and defaults for the remaining fields.
func (*MsgGetCFilters) Command ¶
func (msg *MsgGetCFilters) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgGetCFilters) MaxPayloadLength ¶
func (msg *MsgGetCFilters) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgGetCFilters) VVSDecode ¶
func (msg *MsgGetCFilters) VVSDecode(r io.Reader, pver uint32, _ MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgGetCFilters) VVSEncode ¶
func (msg *MsgGetCFilters) VVSEncode(w io.Writer, pver uint32, _ MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgGetData ¶
type MsgGetData struct {
InvList []*InvVect
}
MsgGetData implements the Message interface and represents a bitcoin getdata message. It is used to request data such as blocks and transactions from another peer. It should be used in response to the inv (MsgInv) message to request the actual data referenced by each inventory vector the receiving peer doesn't already have. Each message is limited to a maximum number of inventory vectors, which is currently 50,000. As a result, multiple messages must be used to request larger amounts of data.
Use the AddInvVect function to build up the list of inventory vectors when sending a getdata message to another peer.
func NewMsgGetData ¶
func NewMsgGetData() *MsgGetData
NewMsgGetData returns a new bitcoin getdata message that conforms to the Message interface. See MsgGetData for details.
func NewMsgGetDataSizeHint ¶
func NewMsgGetDataSizeHint(sizeHint uint) *MsgGetData
NewMsgGetDataSizeHint returns a new bitcoin getdata message that conforms to the Message interface. See MsgGetData for details. This function differs from NewMsgGetData in that it allows a default allocation size for the backing array which houses the inventory vector list. This allows callers who know in advance how large the inventory list will grow to avoid the overhead of growing the internal backing array several times when appending large amounts of inventory vectors with AddInvVect. Note that the specified hint is just that - a hint that is used for the default allocation size. Adding more (or less) inventory vectors will still work properly. The size hint is limited to MaxInvPerMsg.
func (*MsgGetData) AddInvVect ¶
func (msg *MsgGetData) AddInvVect(iv *InvVect) error
AddInvVect adds an inventory vector to the message.
func (*MsgGetData) Command ¶
func (msg *MsgGetData) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgGetData) MaxPayloadLength ¶
func (msg *MsgGetData) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgGetData) VVSDecode ¶
func (msg *MsgGetData) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgGetData) VVSEncode ¶
func (msg *MsgGetData) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgGetHeaders ¶
type MsgGetHeaders struct { ProtocolVersion uint32 BlockLocatorHashes []*common.Hash HashStop common.Hash }
MsgGetHeaders implements the Message interface and represents a bitcoin getheaders message. It is used to request a list of block headers for blocks starting after the last known hash in the slice of block locator hashes. The list is returned via a headers message (MsgHeaders) and is limited by a specific hash to stop at or the maximum number of block headers per message, which is currently 2000.
Set the HashStop field to the hash at which to stop and use AddBlockLocatorHash to build up the list of block locator hashes.
The algorithm for building the block locator hashes should be to add the hashes in reverse order until you reach the genesis block. In order to keep the list of locator hashes to a resonable number of entries, first add the most recent 10 block hashes, then double the step each loop iteration to exponentially decrease the number of hashes the further away from head and closer to the genesis block you get.
func NewMsgGetHeaders ¶
func NewMsgGetHeaders() *MsgGetHeaders
NewMsgGetHeaders returns a new bitcoin getheaders message that conforms to the Message interface. See MsgGetHeaders for details.
func (*MsgGetHeaders) AddBlockLocatorHash ¶
func (msg *MsgGetHeaders) AddBlockLocatorHash(hash *common.Hash) error
AddBlockLocatorHash adds a new block locator hash to the message.
func (*MsgGetHeaders) Command ¶
func (msg *MsgGetHeaders) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgGetHeaders) MaxPayloadLength ¶
func (msg *MsgGetHeaders) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgGetHeaders) VVSDecode ¶
func (msg *MsgGetHeaders) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgGetHeaders) VVSEncode ¶
func (msg *MsgGetHeaders) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgHeaders ¶
type MsgHeaders struct {
Headers []*BlockHeader
}
MsgHeaders implements the Message interface and represents a bitcoin headers message. It is used to deliver block header information in response to a getheaders message (MsgGetHeaders). The maximum number of block headers per message is currently 2000. See MsgGetHeaders for details on requesting the headers.
func NewMsgHeaders ¶
func NewMsgHeaders() *MsgHeaders
NewMsgHeaders returns a new bitcoin headers message that conforms to the Message interface. See MsgHeaders for details.
func (*MsgHeaders) AddBlockHeader ¶
func (msg *MsgHeaders) AddBlockHeader(bh *BlockHeader) error
AddBlockHeader adds a new block header to the message.
func (*MsgHeaders) Command ¶
func (msg *MsgHeaders) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgHeaders) MaxPayloadLength ¶
func (msg *MsgHeaders) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgHeaders) VVSDecode ¶
func (msg *MsgHeaders) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgHeaders) VVSEncode ¶
func (msg *MsgHeaders) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgInv ¶
type MsgInv struct {
InvList []*InvVect
}
MsgInv implements the Message interface and represents a bitcoin inv message. It is used to advertise a peer's known data such as blocks and transactions through inventory vectors. It may be sent unsolicited to inform other peers of the data or in response to a getblocks message (MsgGetBlocks). Each message is limited to a maximum number of inventory vectors, which is currently 50,000.
Use the AddInvVect function to build up the list of inventory vectors when sending an inv message to another peer.
func NewMsgInv ¶
func NewMsgInv() *MsgInv
NewMsgInv returns a new bitcoin inv message that conforms to the Message interface. See MsgInv for details.
func NewMsgInvSizeHint ¶
NewMsgInvSizeHint returns a new bitcoin inv message that conforms to the Message interface. See MsgInv for details. This function differs from NewMsgInv in that it allows a default allocation size for the backing array which houses the inventory vector list. This allows callers who know in advance how large the inventory list will grow to avoid the overhead of growing the internal backing array several times when appending large amounts of inventory vectors with AddInvVect. Note that the specified hint is just that - a hint that is used for the default allocation size. Adding more (or less) inventory vectors will still work properly. The size hint is limited to MaxInvPerMsg.
func (*MsgInv) AddInvVect ¶
AddInvVect adds an inventory vector to the message.
func (*MsgInv) Command ¶
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgInv) MaxPayloadLength ¶
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
type MsgMemPool ¶
type MsgMemPool struct{}
MsgMemPool implements the Message interface and represents a bitcoin mempool message. It is used to request a list of transactions still in the active memory pool of a relay.
This message has no payload and was not added until protocol versions starting with BIP0035Version.
func NewMsgMemPool ¶
func NewMsgMemPool() *MsgMemPool
NewMsgMemPool returns a new bitcoin pong message that conforms to the Message interface. See MsgPong for details.
func (*MsgMemPool) Command ¶
func (msg *MsgMemPool) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgMemPool) MaxPayloadLength ¶
func (msg *MsgMemPool) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgMemPool) VVSDecode ¶
func (msg *MsgMemPool) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgMemPool) VVSEncode ¶
func (msg *MsgMemPool) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgMerkleBlock ¶
type MsgMerkleBlock struct { Header BlockHeader Transactions uint32 Hashes []*common.Hash Flags []byte }
MsgMerkleBlock implements the Message interface and represents a bitcoin merkleblock message which is used to reset a Bloom filter.
This message was not added until protocol version BIP0037Version.
func NewMsgMerkleBlock ¶
func NewMsgMerkleBlock(bh *BlockHeader) *MsgMerkleBlock
NewMsgMerkleBlock returns a new bitcoin merkleblock message that conforms to the Message interface. See MsgMerkleBlock for details.
func (*MsgMerkleBlock) AddTxHash ¶
func (msg *MsgMerkleBlock) AddTxHash(hash *common.Hash) error
AddTxHash adds a new transaction hash to the message.
func (*MsgMerkleBlock) Command ¶
func (msg *MsgMerkleBlock) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgMerkleBlock) MaxPayloadLength ¶
func (msg *MsgMerkleBlock) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgMerkleBlock) VVSDecode ¶
func (msg *MsgMerkleBlock) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgMerkleBlock) VVSEncode ¶
func (msg *MsgMerkleBlock) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgNotFound ¶
type MsgNotFound struct {
InvList []*InvVect
}
MsgNotFound defines a bitcoin notfound message which is sent in response to a getdata message if any of the requested data in not available on the peer. Each message is limited to a maximum number of inventory vectors, which is currently 50,000.
Use the AddInvVect function to build up the list of inventory vectors when sending a notfound message to another peer.
func NewMsgNotFound ¶
func NewMsgNotFound() *MsgNotFound
NewMsgNotFound returns a new bitcoin notfound message that conforms to the Message interface. See MsgNotFound for details.
func (*MsgNotFound) AddInvVect ¶
func (msg *MsgNotFound) AddInvVect(iv *InvVect) error
AddInvVect adds an inventory vector to the message.
func (*MsgNotFound) Command ¶
func (msg *MsgNotFound) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgNotFound) MaxPayloadLength ¶
func (msg *MsgNotFound) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgNotFound) VVSDecode ¶
func (msg *MsgNotFound) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgNotFound) VVSEncode ¶
func (msg *MsgNotFound) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgPing ¶
type MsgPing struct { // Unique value associated with message that is used to identify // specific ping message. Nonce uint64 }
MsgPing implements the Message interface and represents a bitcoin ping message.
For versions BIP0031Version and earlier, it is used primarily to confirm that a connection is still valid. A transmission error is typically interpreted as a closed connection and that the peer should be removed. For versions AFTER BIP0031Version it contains an identifier which can be returned in the pong message to determine network timing.
The payload for this message just consists of a nonce used for identifying it later.
func NewMsgPing ¶
NewMsgPing returns a new bitcoin ping message that conforms to the Message interface. See MsgPing for details.
func (*MsgPing) Command ¶
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgPing) MaxPayloadLength ¶
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
type MsgPong ¶
type MsgPong struct { // Unique value associated with message that is used to identify // specific ping message. Nonce uint64 }
MsgPong implements the Message interface and represents a bitcoin pong message which is used primarily to confirm that a connection is still valid in response to a bitcoin ping message (MsgPing).
This message was not added until protocol versions AFTER BIP0031Version.
func NewMsgPong ¶
NewMsgPong returns a new bitcoin pong message that conforms to the Message interface. See MsgPong for details.
func (*MsgPong) Command ¶
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgPong) MaxPayloadLength ¶
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
type MsgReject ¶
type MsgReject struct { // Cmd is the command for the message which was rejected such as // as CmdBlock or CmdTx. This can be obtained from the Command function // of a Message. Cmd string // RejectCode is a code indicating why the command was rejected. It // is encoded as a uint8 on the protos. Code RejectCode // Reason is a human-readable string with specific details (over and // above the reject code) about why the command was rejected. Reason string // Hash identifies a specific block or transaction that was rejected // and therefore only applies the MsgBlock and MsgTx messages. Hash common.Hash }
MsgReject implements the Message interface and represents a bitcoin reject message.
This message was not added until protocol version RejectVersion.
func NewMsgReject ¶
func NewMsgReject(command string, code RejectCode, reason string) *MsgReject
NewMsgReject returns a new bitcoin reject message that conforms to the Message interface. See MsgReject for details.
func (*MsgReject) Command ¶
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgReject) MaxPayloadLength ¶
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
type MsgSendHeaders ¶
type MsgSendHeaders struct{}
MsgSendHeaders implements the Message interface and represents a bitcoin sendheaders message. It is used to request the peer send block headers rather than inventory vectors.
This message has no payload and was not added until protocol versions starting with SendHeadersVersion.
func NewMsgSendHeaders ¶
func NewMsgSendHeaders() *MsgSendHeaders
NewMsgSendHeaders returns a new bitcoin sendheaders message that conforms to the Message interface. See MsgSendHeaders for details.
func (*MsgSendHeaders) Command ¶
func (msg *MsgSendHeaders) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgSendHeaders) MaxPayloadLength ¶
func (msg *MsgSendHeaders) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgSendHeaders) VVSDecode ¶
func (msg *MsgSendHeaders) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. This is part of the Message interface implementation.
func (*MsgSendHeaders) VVSEncode ¶
func (msg *MsgSendHeaders) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type MsgTx ¶
type MsgTx struct { Version uint32 //对于虚拟交易,表示对应的真实交易的索引号。 TxIn []*TxIn TxOut []*TxOut TxContract TxContract LockTime uint32 }
MsgTx implements the Message interface and represents an asimov tx message. It is used to deliver transaction information in response to a getdata message (MsgGetData) for a given transaction.
Use the AddTxIn and AddTxOut functions to build up the list of transaction inputs and outputs.
func NewMsgTx ¶
NewMsgTx returns a new asimov tx message that conforms to the Message interface. The return instance has a default version of TxVersion and there are no transaction inputs or outputs. Also, the lock time is set to zero to indicate the transaction is valid immediately as opposed to some time in future.
func (*MsgTx) Command ¶
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgTx) Copy ¶
Copy creates a deep copy of a transaction so that the original does not get modified when the copy is manipulated.
func (*MsgTx) Deserialize ¶
Deserialize decodes a transaction from r into the receiver using a format that is suitable for long-term storage such as a database while respecting the Version field in the transaction. This function differs from VVSDecode in that VVSDecode decodes from the asimov protos protocol as it was sent across the network. The protos encoding can technically differ depending on the protocol version and doesn't even really need to match the format of a stored transaction at all. As of the time this comment was written, the encoded transaction is the same in both instances, but there is a distinct difference and separating the two allows the API to be flexible enough to deal with changes.
func (*MsgTx) MaxPayloadLength ¶
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgTx) PkScriptLocs ¶
PkScriptLocs returns a slice containing the start of each public key script within the raw serialized transaction. The caller can easily obtain the length of each script by using len on the script available via the appropriate transaction output entry.
func (*MsgTx) Serialize ¶
Serialize encodes the transaction to w using a format that suitable for long-term storage such as a database while respecting the Version field in the transaction. This function differs from VVSEncode in that VVSEncode encodes the transaction to the asimov protos protocol in order to be sent across the network. The protos encoding can technically differ depending on the protocol version and doesn't even really need to match the format of a stored transaction at all. As of the time this comment was written, the encoded transaction is the same in both instances, but there is a distinct difference and separating the two allows the API to be flexible enough to deal with changes.
func (*MsgTx) SerializeSize ¶
SerializeSize returns the number of bytes it would take to serialize the the transaction.
func (*MsgTx) SetTxContract ¶
func (msg *MsgTx) SetTxContract(tc *TxContract)
AddTxContract adds a transaction contract to the message.
func (*MsgTx) TransactionHash ¶
If a transaction has no witness data, then the witness hash, is the same as its txid.
func (*MsgTx) VVSDecode ¶
VVSDecode decodes r using the asimov protocol encoding into the receiver. This is part of the Message interface implementation. See Deserialize for decoding transactions stored to disk, such as in a database, as opposed to decoding transactions from the protos.
type MsgVBlock ¶
MsgVBlock implements the Message interface and represents an asimov block message. It is used to deliver block and transaction information in response to a getdata message (MsgGetData) for a given block hash.
func (*MsgVBlock) AddTransaction ¶
AddTransaction adds a transaction to the message.
func (*MsgVBlock) Deserialize ¶
Deserialize decodes a virtual block from r into the receiver using a format that is suitable for long-term storage such as a database while respecting the Version field in the virtual block. The protos encoding can technically differ depending on the protocol version and doesn't even really need to match the format of a stored virtual block at all. As of the time this comment was written, the encoded virtual block is the same in both instances, but there is a distinct difference and separating the two allows the API to be flexible enough to deal with changes.
func (*MsgVBlock) DeserializeTxLoc ¶
DeserializeTxLoc decodes r in the same manner Deserialize does, but it takes a byte buffer instead of a generic reader and returns a slice containing the start and length of each transaction within the raw data that is being deserialized.
func (*MsgVBlock) Serialize ¶
Serialize encodes the virtual block to w using a format that suitable for long-term storage such as a database while respecting the Version field in the block. The protos encoding can technically differ depending on the protocol version and doesn't even really need to match the format of a stored virtual block at all. As of the time this comment was written, the encoded virtual block is the same in both instances, but there is a distinct difference and separating the two allows the API to be flexible enough to deal with changes.
func (*MsgVBlock) SerializeSize ¶
SerializeSize returns the number of bytes it would take to serialize the block, factoring in any witness data within transaction.
type MsgVerAck ¶
type MsgVerAck struct{}
MsgVerAck defines a bitcoin verack message which is used for a peer to acknowledge a version message (MsgVersion) after it has used the information to negotiate parameters. It implements the Message interface.
This message has no payload.
func NewMsgVerAck ¶
func NewMsgVerAck() *MsgVerAck
NewMsgVerAck returns a new bitcoin verack message that conforms to the Message interface.
func (*MsgVerAck) Command ¶
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgVerAck) MaxPayloadLength ¶
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
type MsgVersion ¶
type MsgVersion struct { // Version of the protocol the node is using. ProtocolVersion uint32 // Bitfield which identifies the enabled services. Services common.ServiceFlag // Time the message was generated. This is encoded as an int64 on the protos. Timestamp int64 // 4 bytes Magic common.AsimovNet // ChainId is used to distinguish different chain, the main chain occupy zero, // each subchain take a positive integer ChainId uint64 // Address of the remote peer. AddrYou NetAddress // Address of the local peer. AddrMe NetAddress // Unique value associated with message that is used to detect self // connections. Nonce uint64 // The user agent that generated messsage. This is an encoded as a varString // on the protos. This has a max length of MaxUserAgentLen. UserAgent string // Last block seen by the generator of the version message. LastBlock int32 // Don't announce transactions to peer. DisableRelayTx bool }
MsgVersion implements the Message interface and represents a bitcoin version message. It is used for a peer to advertise itself as soon as an outbound connection is made. The remote peer then uses this information along with its own to negotiate. The remote peer must then respond with a version message of its own containing the negotiated values followed by a verack message (MsgVerAck). This exchange must take place before any further communication is allowed to proceed.
func NewMsgVersion ¶
func NewMsgVersion(me *NetAddress, you *NetAddress, nonce uint64, lastBlock int32, net common.AsimovNet) *MsgVersion
NewMsgVersion returns a new bitcoin version message that conforms to the Message interface using the passed parameters and defaults for the remaining fields.
func (*MsgVersion) AddService ¶
func (msg *MsgVersion) AddService(service common.ServiceFlag)
AddService adds service as a supported service by the peer generating the message.
func (*MsgVersion) AddUserAgent ¶
func (msg *MsgVersion) AddUserAgent(name string, version string, comments ...string) error
AddUserAgent adds a user agent to the user agent string for the version message. The version string is not defined to any strict format, although it is recommended to use the form "major.minor.revision" e.g. "2.6.41".
func (*MsgVersion) Command ¶
func (msg *MsgVersion) Command() string
Command returns the protocol command string for the message. This is part of the Message interface implementation.
func (*MsgVersion) HasService ¶
func (msg *MsgVersion) HasService(service common.ServiceFlag) bool
HasService returns whether the specified service is supported by the peer that generated the message.
func (*MsgVersion) MaxPayloadLength ¶
func (msg *MsgVersion) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum length the payload can be for the receiver. This is part of the Message interface implementation.
func (*MsgVersion) VVSDecode ¶
func (msg *MsgVersion) VVSDecode(r io.Reader, pver uint32, enc MessageEncoding) error
VVSDecode decodes r using the bitcoin protocol encoding into the receiver. The version message is special in that the protocol version hasn't been negotiated yet. As a result, the pver field is ignored and any fields which are added in new versions are optional. This also mean that r must be a *bytes.Buffer so the number of remaining bytes can be ascertained.
This is part of the Message interface implementation.
func (*MsgVersion) VVSEncode ¶
func (msg *MsgVersion) VVSEncode(w io.Writer, pver uint32, enc MessageEncoding) error
VVSEncode encodes the receiver to w using the bitcoin protocol encoding. This is part of the Message interface implementation.
type NetAddress ¶
type NetAddress struct { // Last time the address was seen. This is, unfortunately, encoded as a // int64 on the protos and therefore is limited to 2106. This field is // present in the flow version message (MsgVersion). Timestamp time.Time // Bitfield which identifies the services supported by the address. Services common.ServiceFlag // IP address of the peer. IP net.IP // Port the peer is using. This is encoded in big endian on the protos // which differs from most everything else. Port uint16 }
NetAddress defines information about a peer on the network including the time it was last seen, the services it supports, its IP address, and port.
func NewNetAddress ¶
func NewNetAddress(addr *net.TCPAddr, services common.ServiceFlag) *NetAddress
NewNetAddress returns a new NetAddress using the provided TCP address and supported services with defaults for the remaining fields.
func NewNetAddressIPPort ¶
func NewNetAddressIPPort(ip net.IP, port uint16, services common.ServiceFlag) *NetAddress
NewNetAddressIPPort returns a new NetAddress using the provided IP, port, and supported services with defaults for the remaining fields.
func NewNetAddressTimestamp ¶
func NewNetAddressTimestamp( timestamp time.Time, services common.ServiceFlag, ip net.IP, port uint16) *NetAddress
NewNetAddressTimestamp returns a new NetAddress using the provided timestamp, IP, port, and supported services. The timestamp is rounded to single second precision.
func (*NetAddress) AddService ¶
func (na *NetAddress) AddService(service common.ServiceFlag)
AddService adds service as a supported service by the peer generating the message.
func (*NetAddress) HasService ¶
func (na *NetAddress) HasService(service common.ServiceFlag) bool
HasService returns whether the specified service is supported by the address.
type OutPoint ¶
OutPoint defines an asimov data type that is used to track previous transaction outputs.
func NewOutPoint ¶
NewOutPoint returns a new asimov transaction outpoint point with the provided hash and index.
type RejectCode ¶
type RejectCode uint8
RejectCode represents a numeric value by which a remote peer indicates why a message was rejected.
const ( RejectMalformed RejectCode = 0x01 RejectInvalid RejectCode = 0x10 RejectObsolete RejectCode = 0x11 RejectDuplicate RejectCode = 0x12 RejectForbidden RejectCode = 0x13 RejectNonstandard RejectCode = 0x40 RejectLowGasPrice RejectCode = 0x41 RejectCheckpoint RejectCode = 0x43 RejectFeeUnsupport RejectCode = 0x44 )
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 TxContract ¶
type TxContract struct {
GasLimit uint32
}
Design on three steps. 1st, Add TxContract struct, done 2nd, Rm TxType done 3rd, Extend TxContract & refactor contract elements: when send a coin to contract, move out to extended TxContract, Standard TxOut only accept addresses with id 0x66 | 0x73
func (*TxContract) SerializeSize ¶
func (t *TxContract) SerializeSize() int
SerializeSize returns the number of bytes it would take to serialize the the transaction contract.
type TxIn ¶
TxIn defines an asimov transaction input.
func NewTxIn ¶
NewTxIn returns a new asimov transaction input with the provided previous outpoint point and signature script with a default sequence of MaxTxInSequenceNum.
func (*TxIn) SerializeSize ¶
SerializeSize returns the number of bytes it would take to serialize the the transaction input.
type TxLoc ¶
TxLoc holds locator data for the offset and length of where a transaction is located within a MsgBlock data buffer.
type TxOut ¶
TxOut defines an asimov transaction output. Value: The amount of asset PkScript: The public key script Data: it may contains contract parameters, or it can be nil.
func NewContractTxOut ¶
NewContractTxOut returns a new asimov contract transaction output with the provides transaction value, public key script and data
func NewTxOut ¶
NewTxOut returns a new asimov transaction output with the provided transaction value and public key script.
func (*TxOut) SerializeSize ¶
SerializeSize returns the number of bytes it would take to serialize the the transaction output.
Source Files
¶
- blockheader.go
- blocksignature.go
- error.go
- invvect.go
- message.go
- msgaddr.go
- msgblock.go
- msgcfcheckpt.go
- msgcfheaders.go
- msgcfilter.go
- msgfeefilter.go
- msgfilteradd.go
- msgfilterclear.go
- msgfilterload.go
- msggetaddr.go
- msggetblocks.go
- msggetcfcheckpt.go
- msggetcfheaders.go
- msggetcfilters.go
- msggetdata.go
- msggetheaders.go
- msgheaders.go
- msginv.go
- msgmempool.go
- msgmerkleblock.go
- msgnotfound.go
- msgping.go
- msgpong.go
- msgreject.go
- msgsendheaders.go
- msgtx.go
- msgvblock.go
- msgverack.go
- msgversion.go
- netaddress.go