Merge pull request #9303 from filecoin-project/9299-messages-with-empty-uuids-to-mpoolpushmessage-will-be-rejected

fix: api: Ignore uuid check for messages with uuid not set
This commit is contained in:
Łukasz Magiera
2022-09-14 08:59:11 +02:00
committed by GitHub
3 changed files with 64 additions and 3 deletions
+4 -3
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"github.com/google/uuid"
"github.com/ipfs/go-cid"
"go.uber.org/fx"
"golang.org/x/xerrors"
@@ -142,8 +143,8 @@ func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, spe
msg = &cp
inMsg := *msg
// Check if this uuid has already been processed
if spec != nil {
// Check if this uuid has already been processed. Ignore if uuid is not populated
if (spec != nil) && (spec.MsgUuid != uuid.UUID{}) {
signedMessage, err := a.MessageSigner.GetSignedMessage(ctx, spec.MsgUuid)
if err == nil {
log.Warnf("Message already processed. cid=%s", signedMessage.Cid())
@@ -206,7 +207,7 @@ func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, spe
}
// Store uuid->signed message in datastore
if spec != nil {
if (spec != nil) && (spec.MsgUuid != uuid.UUID{}) {
err = a.MessageSigner.StoreSignedMessage(ctx, spec.MsgUuid, signedMsg)
if err != nil {
return nil, err