I needed to wrap the code in the while loop with autoreleasepool
let prefix = String(repeating: "0", count: difficulty)
var hash = calculateHash(transaction)
while !hash!.hasPrefix(prefix) {
autoreleasepool {
transaction.nonce += 1
hash = calculateHash(transaction)
}
}
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: