Handle empty payout address case gracefully

* log error instead of crashing if a bounty issue gets merged and bounty
winner has no address
This commit is contained in:
Teemu Patja 2017-03-06 20:47:17 +02:00
parent 9262c3e3c2
commit a8f2d1c1ab
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
1 changed files with 5 additions and 3 deletions

View File

@ -50,9 +50,11 @@
issue-id :issue_id issue-id :issue_id
payout-address :payout_address} (db-bounties/pending-bounties-list) payout-address :payout_address} (db-bounties/pending-bounties-list)
:let [value (eth/get-balance-hex contract-address)]] :let [value (eth/get-balance-hex contract-address)]]
(if (empty? payout-address)
(log/error "Cannot sign pending bounty - winner has no payout address")
(->> (->>
(wallet/execute contract-address payout-address value) (wallet/execute contract-address payout-address value)
(db-bounties/update-execute-hash issue-id)))) (db-bounties/update-execute-hash issue-id)))))
(defn update-confirm-hash (defn update-confirm-hash
"Gets transaction receipt for each pending payout and updates confirm_hash" "Gets transaction receipt for each pending payout and updates confirm_hash"