SatoshiPortal / cyphernode

Modular Bitcoin full-node microservices API server architecture and utilities toolkit to build scalable, secure and featureful apps and services without trusted third parties
MIT License
364 stars 68 forks source link

Newblock - replace core call to proxy by pub to broker #265

Closed phillamy closed 2 years ago

phillamy commented 2 years ago

Replace Core call to curl proxy/newblock by a call to pubNewBlock.sh inside Core's Docker image. The script calls this : mosquitto_pub -h broker -t bitcoin_node_newblock -m "$blockhash"

On the proxy side, the bitcoin_node_newblock.sh runs in the bg and reads from this topic. It performs the same operations as before.

I had to change Core's Docker image to add MQTT rt stuff. I had to modify BITCOIN_VERSION to use my own in setup.sh

phillamy commented 2 years ago

Made a few changes in the script running on the node: When a new block event is triggered, it publishes a message a=on the newblock topic for existing consumers. It also sends a message on the bitcoin_node_new_tip topic (new topic). Before sending this message, it compares the current blockchain tip (getblockchaininfo) with the current "new block event". It only sends the event if the block height matches the chain tip. Theses events do not arrive sequentially if there is a block storm.

phillamy commented 2 years ago

Updated test-manage-missed.sh with new CB server

==> Please squash and merge