[fix #8638] issues with wallet transaction list

- pending transaction was using hash so mined transaction was using it's id
to have a unique id, the fix adds a rule when the existing transaction by hash
is in :pending state, the mined transaction overwrites it

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2019-07-25 20:10:29 +02:00
parent 16fac293ba
commit 89abc8ab11
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
1 changed files with 7 additions and 2 deletions

View File

@ -124,10 +124,15 @@
transfer-by-id (get-in db [:wallet :transaction id])
unique-id (when-not (or transfer-by-id
(= transfer transfer-by-hash))
(if transfer-by-hash id hash))]
(if (and transfer-by-hash
(not (= :pending
(:type transfer-by-hash))))
id
hash))]
(when unique-id
(fx/merge cofx
{:db (assoc-in db [:wallet :transactions unique-id] transfer)}
{:db (assoc-in db [:wallet :transactions unique-id]
(assoc transfer :hash unique-id))}
(check-transaction transfer)))))
(fx/defn new-transfers