[NOD-427] Selected tip notification (#494)

* [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

* [NOD-427] Fix findHashOfBluestBlock to handle empty blocks table

* [NOD-427] Return httpserverutils.HasDBError(dbErrors)
This commit is contained in:
Ori Newman 2019-11-26 16:46:12 +02:00 committed by Dan Aharoni
parent 532e57b61c
commit 0c9e55a358

View File

@ -181,7 +181,7 @@ func findHashOfBluestBlock(mustBeChainBlock bool) (*string, error) {
if httpserverutils.HasDBError(dbErrors) {
return nil, httpserverutils.NewErrorFromDBErrors("failed to find hash of bluest block: ", dbErrors)
}
if httpserverutils.IsDBRecordNotFoundError(dbErrors) {
if len(blockHashes) == 0 {
return nil, nil
}
return &blockHashes[0], nil