fix #849
This commit is contained in:
parent
878b8b2b81
commit
e28b1aeea1
|
@ -8,7 +8,11 @@
|
||||||
|
|
||||||
(defn- parse-payload [payload]
|
(defn- parse-payload [payload]
|
||||||
(debug :parse-payload)
|
(debug :parse-payload)
|
||||||
(r/read-string (u/to-utf8 payload)))
|
(try
|
||||||
|
{:payload (r/read-string (u/to-utf8 payload))}
|
||||||
|
(catch :default err
|
||||||
|
(debug :parse-payload-error err)
|
||||||
|
{:error err})))
|
||||||
|
|
||||||
(defn- decrypt [key content]
|
(defn- decrypt [key content]
|
||||||
(try
|
(try
|
||||||
|
@ -36,12 +40,14 @@
|
||||||
(let [{:keys [from payload to] :as message}
|
(let [{:keys [from payload to] :as message}
|
||||||
(js->clj js-message :keywordize-keys true)
|
(js->clj js-message :keywordize-keys true)
|
||||||
|
|
||||||
{:keys [type ack?] :as payload'}
|
{{:keys [type ack?] :as payload'} :payload
|
||||||
|
payload-error :error}
|
||||||
(parse-payload payload)]
|
(parse-payload payload)]
|
||||||
(when (or (not= (i/normalize-hex identity)
|
(when (and (not payload-error)
|
||||||
(i/normalize-hex from))
|
(or (not= (i/normalize-hex identity)
|
||||||
;; allow user to receive his own discoveries
|
(i/normalize-hex from))
|
||||||
(= type :discover))
|
;; allow user to receive his own discoveries
|
||||||
|
(= type :discover)))
|
||||||
(let [{:keys [content error]} (parse-content (:private keypair)
|
(let [{:keys [content error]} (parse-content (:private keypair)
|
||||||
payload'
|
payload'
|
||||||
(not= "0x0" to))]
|
(not= "0x0" to))]
|
||||||
|
|
Loading…
Reference in New Issue