Sha256: d21a9b1bb874b7dc1c3c8614d9440c62d25067ca433edc223e1573923eb622d3

Contents?: true

Size: 770 Bytes

Versions: 3

Compression:

Stored size: 770 Bytes

Contents

module LND
  module Tool

    # Use SubscribeHtlcEvents to get HTLC events from LND and store them in the DB.
    class HTLCEventCapture

      attr_reader :client

      def initialize(config)
        @client = Lnrpc::Client.new({
                                      credentials_path: config['credentials_path'],
                                      macaroon_path: config['macaroon_path'],
                                      address: "#{config['host']}:#{config['port']}"
                                    })
      end

      # Start capture.
      def start
        store = Store::HTLCEvent.new
        client.router.subscribe_htlc_events.each do |htlc_event|
          puts htlc_event
          store.save(htlc_event)
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lnd-tool-0.3.0 lib/lnd/tool/htlc_event_capture.rb
lnd-tool-0.2.0 lib/lnd/tool/htlc_event_capture.rb
lnd-tool-0.1.0 lib/lnd/tool/htlc_event_capture.rb