From c0b8374783507816155084e498c38fe913b023ef Mon Sep 17 00:00:00 2001 From: Piotr Macek <4007944+piotrm50@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:26:03 +0200 Subject: [PATCH] Do not return EmptyBlockID as a shallow like parent. --- pkg/protocol/engine/tipselection/v1/tip_selection.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/protocol/engine/tipselection/v1/tip_selection.go b/pkg/protocol/engine/tipselection/v1/tip_selection.go index da01c2c0c..a4820acbe 100644 --- a/pkg/protocol/engine/tipselection/v1/tip_selection.go +++ b/pkg/protocol/engine/tipselection/v1/tip_selection.go @@ -186,7 +186,12 @@ func (t *TipSelection) likedInsteadReferences(maxLikedInsteadReferencesPerParent return ierrors.Errorf("transaction required for liked instead reference (%s) not found in mem-pool", likedSpenderID) } - necessaryReferences[likedSpenderID] = lo.First(transactionMetadata.ValidAttachments()) + validAttachments := transactionMetadata.ValidAttachments() + if len(validAttachments) == 0 { + return ierrors.Errorf("attachment of the transaction required for liked instead reference (%s) does not exist", likedSpenderID) + } + + necessaryReferences[likedSpenderID] = lo.First(validAttachments) return nil }); err != nil {