From 96728691f742acdf9796c02dfad6e4e9d27e2085 Mon Sep 17 00:00:00 2001 From: hopeyen Date: Thu, 19 Dec 2024 20:40:01 -0800 Subject: [PATCH] fix: unit tests --- disperser/apiserver/disperse_blob_v2.go | 2 +- disperser/apiserver/server_v2_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/disperser/apiserver/disperse_blob_v2.go b/disperser/apiserver/disperse_blob_v2.go index 2e76d3a45d..4e3e8ca7dc 100644 --- a/disperser/apiserver/disperse_blob_v2.go +++ b/disperser/apiserver/disperse_blob_v2.go @@ -118,7 +118,7 @@ func (s *DispersalServerV2) validateDispersalRequest(ctx context.Context, req *p return api.NewErrorInvalidArg("payment metadata is required") } - if len(blobHeader.PaymentMetadata.AccountID) == 0 || (blobHeader.PaymentMetadata.ReservationPeriod == 0 && blobHeader.PaymentMetadata.CumulativePayment == nil) { + if len(blobHeader.PaymentMetadata.AccountID) == 0 || (blobHeader.PaymentMetadata.ReservationPeriod == 0 && blobHeader.PaymentMetadata.CumulativePayment.Cmp(big.NewInt(0)) == 0) { return api.NewErrorInvalidArg("invalid payment metadata") } diff --git a/disperser/apiserver/server_v2_test.go b/disperser/apiserver/server_v2_test.go index 367d3c9bbb..305b6bd437 100644 --- a/disperser/apiserver/server_v2_test.go +++ b/disperser/apiserver/server_v2_test.go @@ -223,7 +223,7 @@ func TestV2DisperseBlobRequestValidation(t *testing.T) { PaymentHeader: &pbcommon.PaymentHeader{ AccountId: accountID, ReservationPeriod: 0, - CumulativePayment: big.NewInt(100).Bytes(), + CumulativePayment: big.NewInt(0).Bytes(), }, } blobHeader, err := corev2.BlobHeaderFromProtobuf(invalidReqProto)