chainrpc

package
v0.8.1-beta Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func RegisterChainNotifierServer

func RegisterChainNotifierServer(s *grpc.Server, srv ChainNotifierServer)

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type BlockEpoch

type BlockEpoch struct {
	// The hash of the block.
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// The height of the block.
	Height               uint32   `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*BlockEpoch) Descriptor

func (*BlockEpoch) Descriptor() ([]byte, []int)

func (*BlockEpoch) GetHash

func (m *BlockEpoch) GetHash() []byte

func (*BlockEpoch) GetHeight

func (m *BlockEpoch) GetHeight() uint32

func (*BlockEpoch) ProtoMessage

func (*BlockEpoch) ProtoMessage()

func (*BlockEpoch) Reset

func (m *BlockEpoch) Reset()

func (*BlockEpoch) String

func (m *BlockEpoch) String() string

func (*BlockEpoch) XXX_DiscardUnknown

func (m *BlockEpoch) XXX_DiscardUnknown()

func (*BlockEpoch) XXX_Marshal

func (m *BlockEpoch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BlockEpoch) XXX_Merge

func (m *BlockEpoch) XXX_Merge(src proto.Message)

func (*BlockEpoch) XXX_Size

func (m *BlockEpoch) XXX_Size() int

func (*BlockEpoch) XXX_Unmarshal

func (m *BlockEpoch) XXX_Unmarshal(b []byte) error

type ChainNotifierClient

type ChainNotifierClient interface {
	//
	//RegisterConfirmationsNtfn is a synchronous response-streaming RPC that
	//registers an intent for a client to be notified once a confirmation request
	//has reached its required number of confirmations on-chain.
	//
	//A client can specify whether the confirmation request should be for a
	//particular transaction by its hash or for an output script by specifying a
	//zero hash.
	RegisterConfirmationsNtfn(ctx context.Context, in *ConfRequest, opts ...grpc.CallOption) (ChainNotifier_RegisterConfirmationsNtfnClient, error)
	//
	//RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
	//intent for a client to be notification once a spend request has been spent
	//by a transaction that has confirmed on-chain.
	//
	//A client can specify whether the spend request should be for a particular
	//outpoint  or for an output script by specifying a zero outpoint.
	RegisterSpendNtfn(ctx context.Context, in *SpendRequest, opts ...grpc.CallOption) (ChainNotifier_RegisterSpendNtfnClient, error)
	//
	//RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
	//registers an intent for a client to be notified of blocks in the chain. The
	//stream will return a hash and height tuple of a block for each new/stale
	//block in the chain. It is the client's responsibility to determine whether
	//the tuple returned is for a new or stale block in the chain.
	//
	//A client can also request a historical backlog of blocks from a particular
	//point. This allows clients to be idempotent by ensuring that they do not
	//missing processing a single block within the chain.
	RegisterBlockEpochNtfn(ctx context.Context, in *BlockEpoch, opts ...grpc.CallOption) (ChainNotifier_RegisterBlockEpochNtfnClient, error)
}

ChainNotifierClient is the client API for ChainNotifier service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewChainNotifierClient

func NewChainNotifierClient(cc *grpc.ClientConn) ChainNotifierClient

type ChainNotifierServer

type ChainNotifierServer interface {
	//
	//RegisterConfirmationsNtfn is a synchronous response-streaming RPC that
	//registers an intent for a client to be notified once a confirmation request
	//has reached its required number of confirmations on-chain.
	//
	//A client can specify whether the confirmation request should be for a
	//particular transaction by its hash or for an output script by specifying a
	//zero hash.
	RegisterConfirmationsNtfn(*ConfRequest, ChainNotifier_RegisterConfirmationsNtfnServer) error
	//
	//RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
	//intent for a client to be notification once a spend request has been spent
	//by a transaction that has confirmed on-chain.
	//
	//A client can specify whether the spend request should be for a particular
	//outpoint  or for an output script by specifying a zero outpoint.
	RegisterSpendNtfn(*SpendRequest, ChainNotifier_RegisterSpendNtfnServer) error
	//
	//RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
	//registers an intent for a client to be notified of blocks in the chain. The
	//stream will return a hash and height tuple of a block for each new/stale
	//block in the chain. It is the client's responsibility to determine whether
	//the tuple returned is for a new or stale block in the chain.
	//
	//A client can also request a historical backlog of blocks from a particular
	//point. This allows clients to be idempotent by ensuring that they do not
	//missing processing a single block within the chain.
	RegisterBlockEpochNtfn(*BlockEpoch, ChainNotifier_RegisterBlockEpochNtfnServer) error
}

ChainNotifierServer is the server API for ChainNotifier service.

type ChainNotifier_RegisterBlockEpochNtfnClient

type ChainNotifier_RegisterBlockEpochNtfnClient interface {
	Recv() (*BlockEpoch, error)
	grpc.ClientStream
}

type ChainNotifier_RegisterBlockEpochNtfnServer

type ChainNotifier_RegisterBlockEpochNtfnServer interface {
	Send(*BlockEpoch) error
	grpc.ServerStream
}

type ChainNotifier_RegisterConfirmationsNtfnClient

type ChainNotifier_RegisterConfirmationsNtfnClient interface {
	Recv() (*ConfEvent, error)
	grpc.ClientStream
}

type ChainNotifier_RegisterConfirmationsNtfnServer

type ChainNotifier_RegisterConfirmationsNtfnServer interface {
	Send(*ConfEvent) error
	grpc.ServerStream
}

type ChainNotifier_RegisterSpendNtfnClient

type ChainNotifier_RegisterSpendNtfnClient interface {
	Recv() (*SpendEvent, error)
	grpc.ClientStream
}

type ChainNotifier_RegisterSpendNtfnServer

type ChainNotifier_RegisterSpendNtfnServer interface {
	Send(*SpendEvent) error
	grpc.ServerStream
}

type ConfDetails

type ConfDetails struct {
	// The raw bytes of the confirmed transaction.
	RawTx []byte `protobuf:"bytes,1,opt,name=raw_tx,json=rawTx,proto3" json:"raw_tx,omitempty"`
	// The hash of the block in which the confirmed transaction was included in.
	BlockHash []byte `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
	// The height of the block in which the confirmed transaction was included in.
	BlockHeight uint32 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`
	// The index of the confirmed transaction within the transaction.
	TxIndex              uint32   `protobuf:"varint,4,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ConfDetails) Descriptor

func (*ConfDetails) Descriptor() ([]byte, []int)

func (*ConfDetails) GetBlockHash

func (m *ConfDetails) GetBlockHash() []byte

func (*ConfDetails) GetBlockHeight

func (m *ConfDetails) GetBlockHeight() uint32

func (*ConfDetails) GetRawTx

func (m *ConfDetails) GetRawTx() []byte

func (*ConfDetails) GetTxIndex

func (m *ConfDetails) GetTxIndex() uint32

func (*ConfDetails) ProtoMessage

func (*ConfDetails) ProtoMessage()

func (*ConfDetails) Reset

func (m *ConfDetails) Reset()

func (*ConfDetails) String

func (m *ConfDetails) String() string

func (*ConfDetails) XXX_DiscardUnknown

func (m *ConfDetails) XXX_DiscardUnknown()

func (*ConfDetails) XXX_Marshal

func (m *ConfDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ConfDetails) XXX_Merge

func (m *ConfDetails) XXX_Merge(src proto.Message)

func (*ConfDetails) XXX_Size

func (m *ConfDetails) XXX_Size() int

func (*ConfDetails) XXX_Unmarshal

func (m *ConfDetails) XXX_Unmarshal(b []byte) error

type ConfEvent

type ConfEvent struct {
	// Types that are valid to be assigned to Event:
	//	*ConfEvent_Conf
	//	*ConfEvent_Reorg
	Event                isConfEvent_Event `protobuf_oneof:"event"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*ConfEvent) Descriptor

func (*ConfEvent) Descriptor() ([]byte, []int)

func (*ConfEvent) GetConf

func (m *ConfEvent) GetConf() *ConfDetails

func (*ConfEvent) GetEvent

func (m *ConfEvent) GetEvent() isConfEvent_Event

func (*ConfEvent) GetReorg

func (m *ConfEvent) GetReorg() *Reorg

func (*ConfEvent) ProtoMessage

func (*ConfEvent) ProtoMessage()

func (*ConfEvent) Reset

func (m *ConfEvent) Reset()

func (*ConfEvent) String

func (m *ConfEvent) String() string

func (*ConfEvent) XXX_DiscardUnknown

func (m *ConfEvent) XXX_DiscardUnknown()

func (*ConfEvent) XXX_Marshal

func (m *ConfEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ConfEvent) XXX_Merge

func (m *ConfEvent) XXX_Merge(src proto.Message)

func (*ConfEvent) XXX_OneofWrappers

func (*ConfEvent) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*ConfEvent) XXX_Size

func (m *ConfEvent) XXX_Size() int

func (*ConfEvent) XXX_Unmarshal

func (m *ConfEvent) XXX_Unmarshal(b []byte) error

type ConfEvent_Conf

type ConfEvent_Conf struct {
	Conf *ConfDetails `protobuf:"bytes,1,opt,name=conf,proto3,oneof"`
}

type ConfEvent_Reorg

type ConfEvent_Reorg struct {
	Reorg *Reorg `protobuf:"bytes,2,opt,name=reorg,proto3,oneof"`
}

type ConfRequest

type ConfRequest struct {
	//
	//The transaction hash for which we should request a confirmation notification
	//for. If set to a hash of all zeros, then the confirmation notification will
	//be requested for the script instead.
	Txid []byte `protobuf:"bytes,1,opt,name=txid,proto3" json:"txid,omitempty"`
	//
	//An output script within a transaction with the hash above which will be used
	//by light clients to match block filters. If the transaction hash is set to a
	//hash of all zeros, then a confirmation notification will be requested for
	//this script instead.
	Script []byte `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"`
	//
	//The number of desired confirmations the transaction/output script should
	//reach before dispatching a confirmation notification.
	NumConfs uint32 `protobuf:"varint,3,opt,name=num_confs,json=numConfs,proto3" json:"num_confs,omitempty"`
	//
	//The earliest height in the chain for which the transaction/output script
	//could have been included in a block. This should in most cases be set to the
	//broadcast height of the transaction/output script.
	HeightHint           uint32   `protobuf:"varint,4,opt,name=height_hint,json=heightHint,proto3" json:"height_hint,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ConfRequest) Descriptor

func (*ConfRequest) Descriptor() ([]byte, []int)

func (*ConfRequest) GetHeightHint

func (m *ConfRequest) GetHeightHint() uint32

func (*ConfRequest) GetNumConfs

func (m *ConfRequest) GetNumConfs() uint32

func (*ConfRequest) GetScript

func (m *ConfRequest) GetScript() []byte

func (*ConfRequest) GetTxid

func (m *ConfRequest) GetTxid() []byte

func (*ConfRequest) ProtoMessage

func (*ConfRequest) ProtoMessage()

func (*ConfRequest) Reset

func (m *ConfRequest) Reset()

func (*ConfRequest) String

func (m *ConfRequest) String() string

func (*ConfRequest) XXX_DiscardUnknown

func (m *ConfRequest) XXX_DiscardUnknown()

func (*ConfRequest) XXX_Marshal

func (m *ConfRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ConfRequest) XXX_Merge

func (m *ConfRequest) XXX_Merge(src proto.Message)

func (*ConfRequest) XXX_Size

func (m *ConfRequest) XXX_Size() int

func (*ConfRequest) XXX_Unmarshal

func (m *ConfRequest) XXX_Unmarshal(b []byte) error

type Config

type Config struct{}

Config is empty for non-chainrpc builds.

type Outpoint

type Outpoint struct {
	// The hash of the transaction.
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// The index of the output within the transaction.
	Index                uint32   `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Outpoint) Descriptor

func (*Outpoint) Descriptor() ([]byte, []int)

func (*Outpoint) GetHash

func (m *Outpoint) GetHash() []byte

func (*Outpoint) GetIndex

func (m *Outpoint) GetIndex() uint32

func (*Outpoint) ProtoMessage

func (*Outpoint) ProtoMessage()

func (*Outpoint) Reset

func (m *Outpoint) Reset()

func (*Outpoint) String

func (m *Outpoint) String() string

func (*Outpoint) XXX_DiscardUnknown

func (m *Outpoint) XXX_DiscardUnknown()

func (*Outpoint) XXX_Marshal

func (m *Outpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Outpoint) XXX_Merge

func (m *Outpoint) XXX_Merge(src proto.Message)

func (*Outpoint) XXX_Size

func (m *Outpoint) XXX_Size() int

func (*Outpoint) XXX_Unmarshal

func (m *Outpoint) XXX_Unmarshal(b []byte) error

type Reorg

type Reorg struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Reorg) Descriptor

func (*Reorg) Descriptor() ([]byte, []int)

func (*Reorg) ProtoMessage

func (*Reorg) ProtoMessage()

func (*Reorg) Reset

func (m *Reorg) Reset()

func (*Reorg) String

func (m *Reorg) String() string

func (*Reorg) XXX_DiscardUnknown

func (m *Reorg) XXX_DiscardUnknown()

func (*Reorg) XXX_Marshal

func (m *Reorg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Reorg) XXX_Merge

func (m *Reorg) XXX_Merge(src proto.Message)

func (*Reorg) XXX_Size

func (m *Reorg) XXX_Size() int

func (*Reorg) XXX_Unmarshal

func (m *Reorg) XXX_Unmarshal(b []byte) error

type SpendDetails

type SpendDetails struct {
	// The outpoint was that spent.
	SpendingOutpoint *Outpoint `protobuf:"bytes,1,opt,name=spending_outpoint,json=spendingOutpoint,proto3" json:"spending_outpoint,omitempty"`
	// The raw bytes of the spending transaction.
	RawSpendingTx []byte `protobuf:"bytes,2,opt,name=raw_spending_tx,json=rawSpendingTx,proto3" json:"raw_spending_tx,omitempty"`
	// The hash of the spending transaction.
	SpendingTxHash []byte `protobuf:"bytes,3,opt,name=spending_tx_hash,json=spendingTxHash,proto3" json:"spending_tx_hash,omitempty"`
	// The input of the spending transaction that fulfilled the spend request.
	SpendingInputIndex uint32 `protobuf:"varint,4,opt,name=spending_input_index,json=spendingInputIndex,proto3" json:"spending_input_index,omitempty"`
	// The height at which the spending transaction was included in a block.
	SpendingHeight       uint32   `protobuf:"varint,5,opt,name=spending_height,json=spendingHeight,proto3" json:"spending_height,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SpendDetails) Descriptor

func (*SpendDetails) Descriptor() ([]byte, []int)

func (*SpendDetails) GetRawSpendingTx

func (m *SpendDetails) GetRawSpendingTx() []byte

func (*SpendDetails) GetSpendingHeight

func (m *SpendDetails) GetSpendingHeight() uint32

func (*SpendDetails) GetSpendingInputIndex

func (m *SpendDetails) GetSpendingInputIndex() uint32

func (*SpendDetails) GetSpendingOutpoint

func (m *SpendDetails) GetSpendingOutpoint() *Outpoint

func (*SpendDetails) GetSpendingTxHash

func (m *SpendDetails) GetSpendingTxHash() []byte

func (*SpendDetails) ProtoMessage

func (*SpendDetails) ProtoMessage()

func (*SpendDetails) Reset

func (m *SpendDetails) Reset()

func (*SpendDetails) String

func (m *SpendDetails) String() string

func (*SpendDetails) XXX_DiscardUnknown

func (m *SpendDetails) XXX_DiscardUnknown()

func (*SpendDetails) XXX_Marshal

func (m *SpendDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SpendDetails) XXX_Merge

func (m *SpendDetails) XXX_Merge(src proto.Message)

func (*SpendDetails) XXX_Size

func (m *SpendDetails) XXX_Size() int

func (*SpendDetails) XXX_Unmarshal

func (m *SpendDetails) XXX_Unmarshal(b []byte) error

type SpendEvent

type SpendEvent struct {
	// Types that are valid to be assigned to Event:
	//	*SpendEvent_Spend
	//	*SpendEvent_Reorg
	Event                isSpendEvent_Event `protobuf_oneof:"event"`
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

func (*SpendEvent) Descriptor

func (*SpendEvent) Descriptor() ([]byte, []int)

func (*SpendEvent) GetEvent

func (m *SpendEvent) GetEvent() isSpendEvent_Event

func (*SpendEvent) GetReorg

func (m *SpendEvent) GetReorg() *Reorg

func (*SpendEvent) GetSpend

func (m *SpendEvent) GetSpend() *SpendDetails

func (*SpendEvent) ProtoMessage

func (*SpendEvent) ProtoMessage()

func (*SpendEvent) Reset

func (m *SpendEvent) Reset()

func (*SpendEvent) String

func (m *SpendEvent) String() string

func (*SpendEvent) XXX_DiscardUnknown

func (m *SpendEvent) XXX_DiscardUnknown()

func (*SpendEvent) XXX_Marshal

func (m *SpendEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SpendEvent) XXX_Merge

func (m *SpendEvent) XXX_Merge(src proto.Message)

func (*SpendEvent) XXX_OneofWrappers

func (*SpendEvent) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*SpendEvent) XXX_Size

func (m *SpendEvent) XXX_Size() int

func (*SpendEvent) XXX_Unmarshal

func (m *SpendEvent) XXX_Unmarshal(b []byte) error

type SpendEvent_Reorg

type SpendEvent_Reorg struct {
	Reorg *Reorg `protobuf:"bytes,2,opt,name=reorg,proto3,oneof"`
}

type SpendEvent_Spend

type SpendEvent_Spend struct {
	Spend *SpendDetails `protobuf:"bytes,1,opt,name=spend,proto3,oneof"`
}

type SpendRequest

type SpendRequest struct {
	//
	//The outpoint for which we should request a spend notification for. If set to
	//a zero outpoint, then the spend notification will be requested for the
	//script instead.
	Outpoint *Outpoint `protobuf:"bytes,1,opt,name=outpoint,proto3" json:"outpoint,omitempty"`
	//
	//The output script for the outpoint above. This will be used by light clients
	//to match block filters. If the outpoint is set to a zero outpoint, then a
	//spend notification will be requested for this script instead.
	Script []byte `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"`
	//
	//The earliest height in the chain for which the outpoint/output script could
	//have been spent. This should in most cases be set to the broadcast height of
	//the outpoint/output script.
	HeightHint           uint32   `protobuf:"varint,3,opt,name=height_hint,json=heightHint,proto3" json:"height_hint,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SpendRequest) Descriptor

func (*SpendRequest) Descriptor() ([]byte, []int)

func (*SpendRequest) GetHeightHint

func (m *SpendRequest) GetHeightHint() uint32

func (*SpendRequest) GetOutpoint

func (m *SpendRequest) GetOutpoint() *Outpoint

func (*SpendRequest) GetScript

func (m *SpendRequest) GetScript() []byte

func (*SpendRequest) ProtoMessage

func (*SpendRequest) ProtoMessage()

func (*SpendRequest) Reset

func (m *SpendRequest) Reset()

func (*SpendRequest) String

func (m *SpendRequest) String() string

func (*SpendRequest) XXX_DiscardUnknown

func (m *SpendRequest) XXX_DiscardUnknown()

func (*SpendRequest) XXX_Marshal

func (m *SpendRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SpendRequest) XXX_Merge

func (m *SpendRequest) XXX_Merge(src proto.Message)

func (*SpendRequest) XXX_Size

func (m *SpendRequest) XXX_Size() int

func (*SpendRequest) XXX_Unmarshal

func (m *SpendRequest) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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