lib/zold/commands/merge.rb
def run(args = [])
      opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
        o.banner = "Usage: zold merge [ID...] [options]
Available options:"
        o.bool '--skip-propagate',
          'Don\'t propagate after merge',
          default: false
        o.bool '--skip-legacy',
          'Don\'t make legacy transactions (older than 24 hours) immutable',
          default: false
        o.bool '--quiet-if-absent',
          'Don\'t fail if the wallet is absent',
          default: false
        o.integer '--depth',
          'How many levels down we try to pull other wallets if their confirmations are required (default: 0)',
          default: 0
        o.bool '--allow-negative-balance',
          'Don\'t check for the negative balance of the wallet after the merge',
          default: false
        o.bool '--no-baseline',
          'Don\'t treat the highest score master copy as trustable baseline',
          default: false
        o.bool '--edge-baseline',
          'Use any strongest group of nodes as baseline, even if there are no masters inside (dangerous!)',
          default: false
        o.string '--ledger',
          'The name of the file where all new negative transactions will be recorded (default: /dev/null)',
          default: '/dev/null'
        o.string '--trusted',
          'The name of the file with a list of wallet IDs we fully trust and won\'t pull',
          default: '/dev/null'
        o.integer '--trusted-max',
          'The maximum amount of trusted wallets we can see in the list',
          default: 128
        o.string '--network',
          'The name of the network we work in',
          default: 'test'
        o.bool '--help', 'Print instructions'
      end
      mine = Args.new(opts, @log).take || return
      modified = []
      list = mine.empty? ? @wallets.all : mine.map { |i| Id.new(i) }
      list.uniq.each do |id|
        next unless merge(id, Copies.new(File.join(@copies, id)), opts)
        modified << id
        next if opts['skip-propagate']
        require_relative 'propagate'
        modified += Propagate.new(wallets: @wallets, log: @log).run(args)
      end
      modified
    end
def run(args = [])
      opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
        o.banner = "Usage: zold merge [ID...] [options]
Available options:"
        o.bool '--skip-propagate',
          'Don\'t propagate after merge',
          default: false
        o.bool '--skip-legacy',
          'Don\'t make legacy transactions (older than 24 hours) immutable',
          default: false
        o.bool '--quiet-if-absent',
          'Don\'t fail if the wallet is absent',
          default: false
        o.integer '--depth',
          'How many levels down we try to pull other wallets if their confirmations are required (default: 0)',
          default: 0
        o.bool '--allow-negative-balance',
          'Don\'t check for the negative balance of the wallet after the merge',
          default: false
        o.bool '--no-baseline',
          'Don\'t treat the highest score master copy as trustable baseline',
          default: false
        o.bool '--edge-baseline',
          'Use any strongest group of nodes as baseline, even if there are no masters inside (dangerous!)',
          default: false
        o.string '--ledger',
          'The name of the file where all new negative transactions will be recorded (default: /dev/null)',
          default: '/dev/null'
        o.string '--trusted',
          'The name of the file with a list of wallet IDs we fully trust and won\'t pull',
          default: '/dev/null'
        o.integer '--trusted-max',
          'The maximum amount of trusted wallets we can see in the list',
          default: 128
        o.string '--network',
          'The name of the network we work in',
          default: 'test'
        o.bool '--help', 'Print instructions'
      end
      mine = Args.new(opts, @log).take || return
      modified = []
      list = mine.empty? ? @wallets.all : mine.map { |i| Id.new(i) }
      list.uniq.each do |id|
        next unless merge(id, Copies.new(File.join(@copies, id)), opts)
        modified << id
        next if opts['skip-propagate']
        require_relative 'propagate'
        modified += Propagate.new(wallets: @wallets, log: @log).run(args)
      end
      modified
    end
Returns the array of modified wallets (IDs)