From eecb4705385689b7963229458257bc8f2d8cc0d4 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 16 Dec 2021 17:00:59 -0800 Subject: [PATCH] server: store the version of the connected lnd node We'll use this in a follow up commit to decide what channel type we want to use. --- server.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/server.go b/server.go index b9ceabb..4d366a2 100644 --- a/server.go +++ b/server.go @@ -52,6 +52,18 @@ var ( "signrpc", "walletrpc", "chainrpc", "invoicesrpc", }, } + + // scriptEnforceVersion is the version of lnd that enabled lease duration script + // enforcement as a new channel type. We'll use this to decide what + // order type to default to. + scriptEnforceVersion = &verrpc.Version{ + AppMajor: 0, + AppMinor: 14, + AppPatch: 0, + BuildTags: []string{ + "signrpc", "walletrpc", "chainrpc", "invoicesrpc", + }, + } ) // Server is the main poold trader server. @@ -71,6 +83,8 @@ type Server struct { // client or an error if none has been established yet. GetIdentity func() (*lsat.TokenID, error) + lndVersion *verrpc.Version + cfg *Config db *clientdb.DB fundingManager *funding.Manager @@ -128,6 +142,11 @@ func (s *Server) Start() error { return nil } + // Now that we have lnd, lets extract the current version so we can use + // this to gate features that we'll use based on the functionality + // available. + s.lndVersion = s.lndServices.Version + // As there're some other lower-level operations we may need access to, // we'll also make a connection for a "basic client". //