Post

Replies

Boosts

Views

Activity

Reply to Help with fixing high memory usage in proof of work blockchain code
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)       }     }
Replies
Boosts
Views
Activity
Aug ’21