Documentation ¶
Index ¶
- Constants
- func DisableLog()
- func RegisterRouterServer(s *grpc.Server, srv RouterServer)
- func UseLogger(logger btclog.Logger)
- type Config
- type PaymentRequest
- func (*PaymentRequest) Descriptor() ([]byte, []int)
- func (m *PaymentRequest) GetCltvLimit() int32
- func (m *PaymentRequest) GetFeeLimitSat() int64
- func (m *PaymentRequest) GetOutgoingChannelId() int64
- func (m *PaymentRequest) GetPayReq() string
- func (m *PaymentRequest) GetTimeoutSeconds() int32
- func (*PaymentRequest) ProtoMessage()
- func (m *PaymentRequest) Reset()
- func (m *PaymentRequest) String() string
- func (m *PaymentRequest) XXX_DiscardUnknown()
- func (m *PaymentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *PaymentRequest) XXX_Merge(src proto.Message)
- func (m *PaymentRequest) XXX_Size() int
- func (m *PaymentRequest) XXX_Unmarshal(b []byte) error
- type PaymentResponse
- func (*PaymentResponse) Descriptor() ([]byte, []int)
- func (m *PaymentResponse) GetPayHash() []byte
- func (m *PaymentResponse) GetPaymentErr() string
- func (m *PaymentResponse) GetPreImage() []byte
- func (*PaymentResponse) ProtoMessage()
- func (m *PaymentResponse) Reset()
- func (m *PaymentResponse) String() string
- func (m *PaymentResponse) XXX_DiscardUnknown()
- func (m *PaymentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *PaymentResponse) XXX_Merge(src proto.Message)
- func (m *PaymentResponse) XXX_Size() int
- func (m *PaymentResponse) XXX_Unmarshal(b []byte) error
- type RouteFeeRequest
- func (*RouteFeeRequest) Descriptor() ([]byte, []int)
- func (m *RouteFeeRequest) GetAmtSat() int64
- func (m *RouteFeeRequest) GetDest() []byte
- func (*RouteFeeRequest) ProtoMessage()
- func (m *RouteFeeRequest) Reset()
- func (m *RouteFeeRequest) String() string
- func (m *RouteFeeRequest) XXX_DiscardUnknown()
- func (m *RouteFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *RouteFeeRequest) XXX_Merge(src proto.Message)
- func (m *RouteFeeRequest) XXX_Size() int
- func (m *RouteFeeRequest) XXX_Unmarshal(b []byte) error
- type RouteFeeResponse
- func (*RouteFeeResponse) Descriptor() ([]byte, []int)
- func (m *RouteFeeResponse) GetRoutingFeeMsat() int64
- func (m *RouteFeeResponse) GetTimeLockDelay() int64
- func (*RouteFeeResponse) ProtoMessage()
- func (m *RouteFeeResponse) Reset()
- func (m *RouteFeeResponse) String() string
- func (m *RouteFeeResponse) XXX_DiscardUnknown()
- func (m *RouteFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *RouteFeeResponse) XXX_Merge(src proto.Message)
- func (m *RouteFeeResponse) XXX_Size() int
- func (m *RouteFeeResponse) XXX_Unmarshal(b []byte) error
- type RouterBackend
- type RouterClient
- type RouterServer
Constants ¶
const Subsystem = "RRPC"
Subsystem defines the logging code for this subsystem.
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 RegisterRouterServer ¶
func RegisterRouterServer(s *grpc.Server, srv RouterServer)
Types ¶
type Config ¶
type Config struct{}
Config is the default config for the package. When the build tag isn't specified, then we output a blank config.
type PaymentRequest ¶
type PaymentRequest struct { // * // A serialized BOLT-11 payment request that contains all information // required to dispatch the payment. If the pay req is invalid, or expired, // an error will be returned. PayReq string `protobuf:"bytes,1,opt,name=pay_req,json=payReq,proto3" json:"pay_req,omitempty"` // * // An absolute limit on the highest fee we should pay when looking for a route // to the destination. Routes with fees higher than this will be ignored, if // there are no routes with a fee below this amount, an error will be // returned. FeeLimitSat int64 `protobuf:"varint,2,opt,name=fee_limit_sat,json=feeLimitSat,proto3" json:"fee_limit_sat,omitempty"` // * // An absolute limit on the cumulative CLTV value along the route for this // payment. Routes with total CLTV values higher than this will be ignored, // if there are no routes with a CLTV value below this amount, an error will // be returned. CltvLimit int32 `protobuf:"varint,3,opt,name=cltv_limit,json=cltvLimit,proto3" json:"cltv_limit,omitempty"` // * // An upper limit on the amount of time we should spend when attempting to // fulfill the payment. This is expressed in seconds. If we cannot make a // successful payment within this time frame, an error will be returned. TimeoutSeconds int32 `protobuf:"varint,4,opt,name=timeout_seconds,json=timeoutSeconds,proto3" json:"timeout_seconds,omitempty"` // * // The channel id of the channel that must be taken to the first hop. If zero, // any channel may be used. OutgoingChannelId int64 `protobuf:"varint,5,opt,name=outgoing_channel_id,json=outgoingChannelId,proto3" json:"outgoing_channel_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PaymentRequest) Descriptor ¶
func (*PaymentRequest) Descriptor() ([]byte, []int)
func (*PaymentRequest) GetCltvLimit ¶
func (m *PaymentRequest) GetCltvLimit() int32
func (*PaymentRequest) GetFeeLimitSat ¶
func (m *PaymentRequest) GetFeeLimitSat() int64
func (*PaymentRequest) GetOutgoingChannelId ¶
func (m *PaymentRequest) GetOutgoingChannelId() int64
func (*PaymentRequest) GetPayReq ¶
func (m *PaymentRequest) GetPayReq() string
func (*PaymentRequest) GetTimeoutSeconds ¶
func (m *PaymentRequest) GetTimeoutSeconds() int32
func (*PaymentRequest) ProtoMessage ¶
func (*PaymentRequest) ProtoMessage()
func (*PaymentRequest) Reset ¶
func (m *PaymentRequest) Reset()
func (*PaymentRequest) String ¶
func (m *PaymentRequest) String() string
func (*PaymentRequest) XXX_DiscardUnknown ¶
func (m *PaymentRequest) XXX_DiscardUnknown()
func (*PaymentRequest) XXX_Marshal ¶
func (m *PaymentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PaymentRequest) XXX_Merge ¶
func (dst *PaymentRequest) XXX_Merge(src proto.Message)
func (*PaymentRequest) XXX_Size ¶
func (m *PaymentRequest) XXX_Size() int
func (*PaymentRequest) XXX_Unmarshal ¶
func (m *PaymentRequest) XXX_Unmarshal(b []byte) error
type PaymentResponse ¶
type PaymentResponse struct { // * // The payment hash that we paid to. Provided so callers are able to map // responses (which may be streaming) back to their original requests. PayHash []byte `protobuf:"bytes,1,opt,name=pay_hash,json=payHash,proto3" json:"pay_hash,omitempty"` // * // The pre-image of the payment successfully completed. PreImage []byte `protobuf:"bytes,2,opt,name=pre_image,json=preImage,proto3" json:"pre_image,omitempty"` // * // If not an empty string, then a string representation of the payment error. PaymentErr string `protobuf:"bytes,3,opt,name=payment_err,json=paymentErr,proto3" json:"payment_err,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PaymentResponse) Descriptor ¶
func (*PaymentResponse) Descriptor() ([]byte, []int)
func (*PaymentResponse) GetPayHash ¶
func (m *PaymentResponse) GetPayHash() []byte
func (*PaymentResponse) GetPaymentErr ¶
func (m *PaymentResponse) GetPaymentErr() string
func (*PaymentResponse) GetPreImage ¶
func (m *PaymentResponse) GetPreImage() []byte
func (*PaymentResponse) ProtoMessage ¶
func (*PaymentResponse) ProtoMessage()
func (*PaymentResponse) Reset ¶
func (m *PaymentResponse) Reset()
func (*PaymentResponse) String ¶
func (m *PaymentResponse) String() string
func (*PaymentResponse) XXX_DiscardUnknown ¶
func (m *PaymentResponse) XXX_DiscardUnknown()
func (*PaymentResponse) XXX_Marshal ¶
func (m *PaymentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PaymentResponse) XXX_Merge ¶
func (dst *PaymentResponse) XXX_Merge(src proto.Message)
func (*PaymentResponse) XXX_Size ¶
func (m *PaymentResponse) XXX_Size() int
func (*PaymentResponse) XXX_Unmarshal ¶
func (m *PaymentResponse) XXX_Unmarshal(b []byte) error
type RouteFeeRequest ¶
type RouteFeeRequest struct { // * // The destination once wishes to obtain a routing fee quote to. Dest []byte `protobuf:"bytes,1,opt,name=dest,proto3" json:"dest,omitempty"` // * // The amount one wishes to send to the target destination. AmtSat int64 `protobuf:"varint,2,opt,name=amt_sat,json=amtSat,proto3" json:"amt_sat,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*RouteFeeRequest) Descriptor ¶
func (*RouteFeeRequest) Descriptor() ([]byte, []int)
func (*RouteFeeRequest) GetAmtSat ¶
func (m *RouteFeeRequest) GetAmtSat() int64
func (*RouteFeeRequest) GetDest ¶
func (m *RouteFeeRequest) GetDest() []byte
func (*RouteFeeRequest) ProtoMessage ¶
func (*RouteFeeRequest) ProtoMessage()
func (*RouteFeeRequest) Reset ¶
func (m *RouteFeeRequest) Reset()
func (*RouteFeeRequest) String ¶
func (m *RouteFeeRequest) String() string
func (*RouteFeeRequest) XXX_DiscardUnknown ¶
func (m *RouteFeeRequest) XXX_DiscardUnknown()
func (*RouteFeeRequest) XXX_Marshal ¶
func (m *RouteFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RouteFeeRequest) XXX_Merge ¶
func (dst *RouteFeeRequest) XXX_Merge(src proto.Message)
func (*RouteFeeRequest) XXX_Size ¶
func (m *RouteFeeRequest) XXX_Size() int
func (*RouteFeeRequest) XXX_Unmarshal ¶
func (m *RouteFeeRequest) XXX_Unmarshal(b []byte) error
type RouteFeeResponse ¶
type RouteFeeResponse struct { // * // A lower bound of the estimated fee to the target destination within the // network, expressed in milli-satoshis. RoutingFeeMsat int64 `protobuf:"varint,1,opt,name=routing_fee_msat,json=routingFeeMsat,proto3" json:"routing_fee_msat,omitempty"` // * // An estimate of the worst case time delay that can occur. Note that callers // will still need to factor in the final CLTV delta of the last hop into this // value. TimeLockDelay int64 `protobuf:"varint,2,opt,name=time_lock_delay,json=timeLockDelay,proto3" json:"time_lock_delay,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*RouteFeeResponse) Descriptor ¶
func (*RouteFeeResponse) Descriptor() ([]byte, []int)
func (*RouteFeeResponse) GetRoutingFeeMsat ¶
func (m *RouteFeeResponse) GetRoutingFeeMsat() int64
func (*RouteFeeResponse) GetTimeLockDelay ¶
func (m *RouteFeeResponse) GetTimeLockDelay() int64
func (*RouteFeeResponse) ProtoMessage ¶
func (*RouteFeeResponse) ProtoMessage()
func (*RouteFeeResponse) Reset ¶
func (m *RouteFeeResponse) Reset()
func (*RouteFeeResponse) String ¶
func (m *RouteFeeResponse) String() string
func (*RouteFeeResponse) XXX_DiscardUnknown ¶
func (m *RouteFeeResponse) XXX_DiscardUnknown()
func (*RouteFeeResponse) XXX_Marshal ¶
func (m *RouteFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RouteFeeResponse) XXX_Merge ¶
func (dst *RouteFeeResponse) XXX_Merge(src proto.Message)
func (*RouteFeeResponse) XXX_Size ¶
func (m *RouteFeeResponse) XXX_Size() int
func (*RouteFeeResponse) XXX_Unmarshal ¶
func (m *RouteFeeResponse) XXX_Unmarshal(b []byte) error
type RouterBackend ¶
type RouterBackend struct { // MaxPaymentMSat is the largest payment permitted by the backend. MaxPaymentMSat lnwire.MilliSatoshi // SelfNode is the vertex of the node sending the payment. SelfNode route.Vertex // FetchChannelCapacity is a closure that we'll use the fetch the total // capacity of a channel to populate in responses. FetchChannelCapacity func(chanID uint64) (btcutil.Amount, error) // FindRoutes is a closure that abstracts away how we locate/query for // routes. FindRoutes func(source, target route.Vertex, amt lnwire.MilliSatoshi, restrictions *routing.RestrictParams, numPaths uint32, finalExpiry ...uint16) ( []*route.Route, error) }
RouterBackend contains the backend implementation of the router rpc sub server calls.
func (*RouterBackend) MarshallRoute ¶
func (r *RouterBackend) MarshallRoute(route *route.Route) *lnrpc.Route
MarshallRoute marshalls an internal route to an rpc route struct.
func (*RouterBackend) QueryRoutes ¶
func (r *RouterBackend) QueryRoutes(ctx context.Context, in *lnrpc.QueryRoutesRequest) (*lnrpc.QueryRoutesResponse, error)
QueryRoutes attempts to query the daemons' Channel Router for a possible route to a target destination capable of carrying a specific amount of satoshis within the route's flow. The retuned route contains the full details required to craft and send an HTLC, also including the necessary information that should be present within the Sphinx packet encapsulated within the HTLC.
TODO(roasbeef): should return a slice of routes in reality * create separate PR to send based on well formatted route
type RouterClient ¶
type RouterClient interface { // * // SendPayment attempts to route a payment described by the passed // PaymentRequest to the final destination. If we are unable to route the // payment, or cannot find a route that satisfies the constraints in the // PaymentRequest, then an error will be returned. Otherwise, the payment // pre-image, along with the final route will be returned. SendPayment(ctx context.Context, in *PaymentRequest, opts ...grpc.CallOption) (*PaymentResponse, error) // * // EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it // may cost to send an HTLC to the target end destination. EstimateRouteFee(ctx context.Context, in *RouteFeeRequest, opts ...grpc.CallOption) (*RouteFeeResponse, error) }
RouterClient is the client API for Router service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewRouterClient ¶
func NewRouterClient(cc *grpc.ClientConn) RouterClient
type RouterServer ¶
type RouterServer interface { // * // SendPayment attempts to route a payment described by the passed // PaymentRequest to the final destination. If we are unable to route the // payment, or cannot find a route that satisfies the constraints in the // PaymentRequest, then an error will be returned. Otherwise, the payment // pre-image, along with the final route will be returned. SendPayment(context.Context, *PaymentRequest) (*PaymentResponse, error) // * // EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it // may cost to send an HTLC to the target end destination. EstimateRouteFee(context.Context, *RouteFeeRequest) (*RouteFeeResponse, error) }
RouterServer is the server API for Router service.