lib/zold/node/safe_entrance.rb
def push(id, body)
      raise 'Id can\'t be nil' if id.nil?
      raise 'Id must be of type Id' unless id.is_a?(Id)
      raise 'Body can\'t be nil' if body.nil?
      Tempfile.open(['', Wallet::EXT]) do |f|
        IO.write(f, body)
        wallet = Wallet.new(f.path)
        wallet.refurbish
        unless wallet.protocol == Zold::PROTOCOL
          raise SoftError, "Protocol mismatch, #{wallet.id} is in '#{wallet.protocol}', we are in '#{Zold::PROTOCOL}'"
        end
        unless wallet.network == @network
          raise SoftError, "Network name mismatch, #{wallet.id} is in '#{wallet.network}', we are in '#{@network}'"
        end
        balance = wallet.balance
        if balance.negative? && !wallet.root?
          raise SoftError, "The balance #{balance} of #{wallet.id} is negative and it's not a root wallet"
        end
        tax = Tax.new(wallet)
        if tax.in_debt?
          raise SoftError, "Taxes are not paid, can't accept the wallet #{wallet.mnemo}; the debt is #{tax.debt} \
(#{tax.debt.to_i} zents); formula ingredients are #{tax.to_text}"
        end
        @entrance.push(id, body)
      end
    end
def push(id, body)
      raise 'Id can\'t be nil' if id.nil?
      raise 'Id must be of type Id' unless id.is_a?(Id)
      raise 'Body can\'t be nil' if body.nil?
      Tempfile.open(['', Wallet::EXT]) do |f|
        IO.write(f, body)
        wallet = Wallet.new(f.path)
        wallet.refurbish
        unless wallet.protocol == Zold::PROTOCOL
          raise SoftError, "Protocol mismatch, #{wallet.id} is in '#{wallet.protocol}', we are in '#{Zold::PROTOCOL}'"
        end
        unless wallet.network == @network
          raise SoftError, "Network name mismatch, #{wallet.id} is in '#{wallet.network}', we are in '#{@network}'"
        end
        balance = wallet.balance
        if balance.negative? && !wallet.root?
          raise SoftError, "The balance #{balance} of #{wallet.id} is negative and it's not a root wallet"
        end
        tax = Tax.new(wallet)
        if tax.in_debt?
          raise SoftError, "Taxes are not paid, can't accept the wallet #{wallet.mnemo}; the debt is #{tax.debt} \
(#{tax.debt.to_i} zents); formula ingredients are #{tax.to_text}"
        end
        @entrance.push(id, body)
      end
    end
Returns a list of modifed wallets (as Zold::Id)