mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Guard against snodes requesting incorrect proof of work
This commit is contained in:
parent
6b19b2180b
commit
6aacbff908
|
@ -93,7 +93,7 @@ public final class LokiAPI : NSObject {
|
|||
invoke(.sendMessage, on: snode, associatedWith: destination, parameters: parameters)
|
||||
}.map2 { rawResponse in
|
||||
if let json = rawResponse as? JSON, let powDifficulty = json["difficulty"] as? Int {
|
||||
guard powDifficulty != LokiAPI.powDifficulty else { return rawResponse }
|
||||
guard powDifficulty != LokiAPI.powDifficulty, powDifficulty < 100 else { return rawResponse }
|
||||
print("[Loki] Setting proof of work difficulty to \(powDifficulty).")
|
||||
LokiAPI.powDifficulty = UInt(powDifficulty)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue