From 90b641c86c8ddccab3435dea3fc16c4cd14dbff6 Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Tue, 22 Nov 2022 10:29:44 -0600 Subject: [PATCH] Add BlockHeader to HeightHash notification. --- db/db.go | 7 ++++++- internal/types.go | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/db/db.go b/db/db.go index 4051c50..d303bf4 100644 --- a/db/db.go +++ b/db/db.go @@ -775,7 +775,12 @@ func (db *ReadOnlyDBColumnFamily) detectChanges(notifCh chan<- interface{}) erro log.Info("error getting block hash: ", err) return err } - notifCh <- &internal.HeightHash{Height: uint64(height), BlockHash: hash} + header, err := db.GetHeader(height) + if err != nil { + log.Info("error getting block header: ", err) + return err + } + notifCh <- &internal.HeightHash{Height: uint64(height), BlockHash: hash, BlockHeader: header} } //TODO: ClearCache log.Warn("implement cache clearing") diff --git a/internal/types.go b/internal/types.go index 4e0977d..40ffa7c 100644 --- a/internal/types.go +++ b/internal/types.go @@ -4,6 +4,7 @@ package internal // HeightHash struct for the height subscription endpoint. type HeightHash struct { - Height uint64 - BlockHash []byte + Height uint64 + BlockHash []byte + BlockHeader []byte }