yenom / BitcoinKit

Bitcoin protocol toolkit for Swift
MIT License
841 stars 261 forks source link

BlockChain sync dont work in background #181

Closed dufflink closed 5 years ago

dufflink commented 5 years ago

Hi!

I need to synchronize with the blockchain in the background. But when I wrap the sync function in DispatchQueue.global(qos: .background).async , the function does not load the blockchain.

2018-11-09 19 51 53 2018-11-09 19 52 33

After the log "testnet-seed.bluematt.me:18333 connecting", nothing happens But in main thread it work perfect What can i do?

dufflink commented 5 years ago

I Resolved this issue:

I created an object OperationQueue in the PeerGroup class .

2018-11-12 16 41 44

Next, you need to wrap 2 functions by .addOperation() in the PeerGroup class .

2018-11-12 16 37 59