Skip to content

Commit

Permalink
Fix crash on new purchase order when no spendable bitcoin outputs exist.
Browse files Browse the repository at this point in the history
Fix crash on new purchase order when no spendable bitcoin outputs exist. Error:
/var/lib/gems/1.9.1/gems/mastercoin-wallet-0.0.11/lib/mastercoin-wallet/builder.rb:114:in `pick_outputs': undefined method `reject!' for nil:NilClass (NoMethodError)
  • Loading branch information
Exocyst committed Dec 21, 2013
1 parent 7ac5762 commit c5ff31d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/mastercoin-wallet/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ def pick_outputs(required_amount)
used_outputs = MastercoinWallet.config.created_transactions.collect{|x| x["in"][0]["prev_out"] }
usuable_outputs = MastercoinWallet.config.spendable_outputs.find{|x| BigDecimal.new(x[:value]) > BigDecimal.new(required_amount.to_s) }

unless usuable_outputs
Qt::MessageBox.critical(self, tr("Could not send transaction"),
tr("It appears there are no spendable outputs for this address that are big enough to transmit this transaction. Please consolidate some coins and send them to your Mastercoin address."))
return
end

usuable_outputs = [usuable_outputs] if usuable_outputs.is_a?(Hash)
usuable_outputs.reject!{|x| puts x; used_outputs.include?(x["prev_out"])}

Expand Down

0 comments on commit c5ff31d

Please sign in to comment.