jamaljsr / polar

One-click Bitcoin Lightning networks for local app development & testing
https://lightningpolar.com
MIT License
781 stars 146 forks source link

Feature Request: GUI block height should detect manually mined blocks using `bitcoin-cli` #1049

Open ZZiigguurraatt opened 1 week ago

ZZiigguurraatt commented 1 week ago

Running bitcoin-cli generatetoaddress to mine blocks does not increase the block height shown in the GUI.

However, we can check the current block height by running bitcoin-cli getblockchaininfo and see that the command actually worked.

If we click "Quick Mine" in the GUI, it will update to include the blocks that were mined through the command line.

jamaljsr commented 1 week ago

Yes, this is somewhat intentional. Polar doesn't subscribe to events occurring on the bitcoind node. So if a block is mined outside of the Polar UI (via CLI or RPC), the block height will not automatically update in the UI. There may be ways to implement this via the bitcoind ZMQ ports or with polling. When you click "Quick Mine", Polar knows to fetch the latest block height after RPC call to bitcoind to mine a block so that the UI reflects the chain. But when things are triggered outside of the Polar UI, you have to tell it to fetch the latest state by click on the "Refresh" button.

I will leave this issue open as a future enhancement, since I wouldn't classify this as a bug.