Post marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
Post marked as solved with 1 replies, 0 views
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)
}
}