Fix claim handling

This commit is contained in:
Vitaliy Vlasov 2018-05-22 18:57:16 +03:00
parent 0d76fcdbc7
commit a8600d1cbd
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964
3 changed files with 26 additions and 26 deletions

View File

@ -356,7 +356,7 @@
balance-eth
tokens
winner-login)
:else nil)]
nil)]
(log/info (str "Updating " owner "/" repo "/" issue-number
" comment #" comment-id " with contents: " comment))
(if (= state :deploying)

View File

@ -125,8 +125,8 @@
:pr_number pr-number
:title pr-title
:user_id user-id
:issue_number (:issue_number issue)
:issue_id (:issue_id issue)
:issue_number (:issue-number issue)
:issue_id (:issue-id issue)
:state event-type}]
;; TODO: in the opened case if the submitting user has no
;; Ethereum address stored, we could post a comment to the
@ -134,17 +134,17 @@
;; merged
(cond
open-or-edit? (do
(log/infof "issue %s: PR with reference to bounty issue opened" (:issue_number issue))
(log/infof "issue %s: PR with reference to bounty issue opened" (:issue-number issue))
(pull-requests/save (merge pr-data {:state :opened
:commit_sha head-sha})))
close? (if merged?
(do (log/infof "issue %s: PR with reference to bounty issue merged" (:issue_number issue))
(do (log/infof "issue %s: PR with reference to bounty issue merged" (:issue-number issue))
(pull-requests/save
(merge pr-data {:state :merged
:commit_sha head-sha}))
(issues/update-commit-sha (:issue_id issue) head-sha)
(db-bounties/update-winner-login (:issue_id issue) login))
(do (log/infof "issue %s: PR with reference to bounty issue closed with no merge" (:issue_number issue))
(issues/update-commit-sha (:issue-id issue) head-sha)
(db-bounties/update-winner-login (:issue-id issue) login))
(do (log/infof "issue %s: PR with reference to bounty issue closed with no merge" (:issue-number issue))
(pull-requests/save
(merge pr-data {:state :closed
:commit_sha head-sha})))))))
@ -177,7 +177,7 @@
(doseq [issue issues]
(if-not (:commit_sha issue) ; no PR has been merged yet referencing this issue
(do
(log/info "Referenced bounty issue found" owner repo (:issue_number issue))
(log/info "Referenced bounty issue found" owner repo (:issue-number issue))
(handle-claim issue
user-id
login name

View File

@ -103,26 +103,26 @@
(defn update-confirm-hash
"Gets transaction receipt for each pending payout and updates DB confirm_hash with tranaction ID of commiteth bot account's confirmation."
[]
[issue-id execute-hash]
(log/info "In update-confirm-hash")
(p :update-confirm-hash
(doseq [{:keys [issue-id execute-hash]} (db-bounties/pending-payouts)]
(try
(log/infof "issue %s: pending payout: %s" issue-id execute-hash)
(try
(when-let [receipt (eth/get-transaction-receipt execute-hash)]
(log/infof "issue %s: execution receipt for issue " issue-id receipt)
(when-let [confirm-hash (multisig/find-confirmation-tx-id receipt)]
(log/infof "issue %s: confirm hash:" issue-id confirm-hash)
(bounties/transition {:issue-id issue-id
:tx-info {:issue-id issue-id
:tx-hash execute-hash
:result confirm-hash
:type :execute}}
:pending-maintainer-confirmation)
))
(catch Throwable ex
(log/errorf ex "issue %s: update-confirm-hash exception:" issue-id))) )
(when-let [receipt (eth/get-transaction-receipt execute-hash)]
(log/infof "issue %s: execution receipt for issue " issue-id receipt)
(when-let [confirm-hash (multisig/find-confirmation-tx-id receipt)]
(log/infof "issue %s: confirm hash: %s" issue-id confirm-hash)
(bounties/transition {:issue-id issue-id
:confirm-hash confirm-hash
:tx-info {:issue-id issue-id
:tx-hash execute-hash
:result confirm-hash
:type :execute}}
:pending-maintainer-confirmation)
))
(catch Throwable ex
(log/errorf ex "issue %s: update-confirm-hash exception:" issue-id)))
(log/info "Exit update-confirm-hash")))
(defn update-confirm-hashes