Longpolling by malbon (untested by kramble)

From pull request
https://github.com/kramble/DE0-Nano-BitCoin-Miner/pull/2