|
|
@ -76,7 +76,7 @@ public final class LokiAPI : NSObject {
|
|
|
|
return lokiMessage.calculatePoW().then { lokiMessageWithPoW in
|
|
|
|
return lokiMessage.calculatePoW().then { lokiMessageWithPoW in
|
|
|
|
return getTargetSnodes(for: destination).map { swarm in
|
|
|
|
return getTargetSnodes(for: destination).map { swarm in
|
|
|
|
return Set(swarm.map { target in
|
|
|
|
return Set(swarm.map { target in
|
|
|
|
sendLokiMessage(lokiMessageWithPoW, to: target).map { rawResponse -> Any in
|
|
|
|
sendLokiMessage(lokiMessageWithPoW, to: target).map { rawResponse in
|
|
|
|
if let json = rawResponse as? JSON, let powDifficulty = json["difficulty"] as? Int {
|
|
|
|
if let json = rawResponse as? JSON, let powDifficulty = json["difficulty"] as? Int {
|
|
|
|
guard powDifficulty != LokiAPI.powDifficulty else { return rawResponse }
|
|
|
|
guard powDifficulty != LokiAPI.powDifficulty else { return rawResponse }
|
|
|
|
print("[Loki] Setting proof of work difficulty to \(powDifficulty).")
|
|
|
|
print("[Loki] Setting proof of work difficulty to \(powDifficulty).")
|
|
|
|