From 076dd01f54ad7ebea4ab84b479d823934461e88c Mon Sep 17 00:00:00 2001 From: hopeyen Date: Thu, 31 Oct 2024 13:51:02 -0700 Subject: [PATCH] refactor: rm comment and update interface input --- api/clients/accountant.go | 6 ++++-- api/clients/disperser_client.go | 4 ++-- core/auth/payment_signer.go | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/clients/accountant.go b/api/clients/accountant.go index d517e28fdc..13dd53999b 100644 --- a/api/clients/accountant.go +++ b/api/clients/accountant.go @@ -16,10 +16,12 @@ import ( var minNumBins uint32 = 3 var requiredQuorums = []uint8{0, 1} -type IAccountant interface { - AccountBlob(ctx context.Context, data []byte, quorums []uint8) (uint32, uint64, error) +type Accountant interface { + AccountBlob(ctx context.Context, numSymbols uint64, quorums []uint8) (*commonpb.PaymentHeader, []byte, error) } +var _ Accountant = &accountant{} + type accountant struct { // on-chain states reservation *core.ActiveReservation diff --git a/api/clients/disperser_client.go b/api/clients/disperser_client.go index fe1576cb9e..b5dff1c052 100644 --- a/api/clients/disperser_client.go +++ b/api/clients/disperser_client.go @@ -66,7 +66,7 @@ type disperserClient struct { // or to use a pool of connections here. conn *grpc.ClientConn client disperser_rpc.DisperserClient - accountant *accountant + accountant Accountant } var _ DisperserClient = &disperserClient{} @@ -91,7 +91,7 @@ var _ DisperserClient = &disperserClient{} // // // Subsequent calls will use the existing connection // status2, requestId2, err := client.DisperseBlob(ctx, otherData, otherQuorums) -func NewDisperserClient(config *Config, signer core.BlobRequestSigner, accountant *accountant) DisperserClient { +func NewDisperserClient(config *Config, signer core.BlobRequestSigner, accountant Accountant) DisperserClient { return &disperserClient{ config: config, signer: signer, diff --git a/core/auth/payment_signer.go b/core/auth/payment_signer.go index 7568e2cc37..bded93c281 100644 --- a/core/auth/payment_signer.go +++ b/core/auth/payment_signer.go @@ -30,7 +30,6 @@ func NewPaymentSigner(privateKeyHex string) *PaymentSigner { } // SignBlobPayment signs the payment header and returns the signature -// func (s *PaymentSigner) SignBlobPayment(header *commonpb.PaymentHeader) ([]byte, error) { func (s *PaymentSigner) SignBlobPayment(pm *core.PaymentMetadata) ([]byte, error) { // header.AccountId = s.GetAccountID() // pm := core.ConvertPaymentHeader(header)