code: def max
        negative = txns.select { |t| t.amount.negative? }
        negative.empty? ? 0 : negative.max_by(&:id).id
      end
docs: Calculate the maximum transaction ID visible currently in the wallet.
   We go through them all and find the largest number. If there are
   no transactions, zero is returned.