26 lines
806 B
Ruby
26 lines
806 B
Ruby
module Mozo
|
|
module Lnd
|
|
def self.client
|
|
credentials = File.read(Rails.application.config.lnd_credentials_path)
|
|
macaroon = File.read(Rails.application.config.lnd_macaroon_path).unpack("H*")
|
|
#Lnrpc::Lightning::Stub.new("localhost:10009", GRPC::Core::ChannelCredentials.new(credentials))
|
|
lnd = Lnrpc::Client.new(credentials_path: Rails.application.config.lnd_credentials_path, macaroon_path: Rails.application.config.lnd_macaroon_path)
|
|
end
|
|
|
|
def self.get_info
|
|
begin
|
|
client.lightning.get_info
|
|
|
|
|
|
rescue StandardError => exception
|
|
if exception&.message =~ /wallet locked/
|
|
Rails.logger.fatal 'FATAL: LND wallet locked'
|
|
#TODO handle wallet locket
|
|
end
|
|
raise exception
|
|
end
|
|
end
|
|
|
|
end
|
|
end
|