mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-10 08:06:44 +00:00

* [NOD-427] Send notifications to `dag/selected-tip` * [NOD-442] Add selected tip notification * [NOD-427] Add comment to PublishSelectedTipNotification * [NOD-427] Remove redundant argument from errors.Wrapf * [NOD-427] Add handleBlockAddedMsg function * [NOD-427] Return errors instead of panicking * [NOD-427] Fix findHashOfBluestBlock to use []string instead of dbmodels.Block * [NOD-427] Add constants * [NOD-427] use path.Join instead of topic+address * [NOD-427] Remove redundant select * [NOD-427] Change break to return
20 lines
447 B
Go
20 lines
447 B
Go
package mqtt
|
|
|
|
import (
|
|
"github.com/daglabs/btcd/apiserver/controllers"
|
|
)
|
|
|
|
const selectedTipTopic = "dag/selected-tip"
|
|
|
|
// PublishSelectedTipNotification publishes notification for a new selected tip
|
|
func PublishSelectedTipNotification(selectedTipHash string) error {
|
|
if !isConnected() {
|
|
return nil
|
|
}
|
|
block, err := controllers.GetBlockByHashHandler(selectedTipHash)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return publish(selectedTipTopic, block)
|
|
}
|