From 2bd6b87e71907dd2fd4678ed2532819450e345eb Mon Sep 17 00:00:00 2001 From: Eval EXEC Date: Thu, 8 Aug 2024 21:24:19 +0800 Subject: [PATCH] Support include_tx_pool param for GetLiveCell --- collector/builder/dao.go | 2 +- indexer/indexer_test.go | 2 +- rpc/client.go | 4 ++-- rpc/client_test.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/collector/builder/dao.go b/collector/builder/dao.go index 0cbd5536..aa07a98c 100644 --- a/collector/builder/dao.go +++ b/collector/builder/dao.go @@ -29,7 +29,7 @@ type DaoTransactionBuilder struct { } func NewDaoTransactionBuilder(network types.Network, iterator collector.CellIterator, daoOutPoint *types.OutPoint, client rpc.Client) (*DaoTransactionBuilder, error) { - cellWithStatus, err := client.GetLiveCell(context.Background(), daoOutPoint, true) + cellWithStatus, err := client.GetLiveCell(context.Background(), daoOutPoint, true, nil) if err != nil { return nil, err } diff --git a/indexer/indexer_test.go b/indexer/indexer_test.go index 359672b1..e9c4ae6e 100644 --- a/indexer/indexer_test.go +++ b/indexer/indexer_test.go @@ -78,7 +78,7 @@ func TestGetCellsMaxLimit(t *testing.T) { } resp, err := c.GetCells(context.Background(), s, SearchOrderAsc, math.MaxUint32, "") checkError(t, err) - assert.Equal(t, 37, len(resp.Objects)) + assert.Equal(t, 36, len(resp.Objects)) // Check response when `WithData` == true in request s = &SearchKey{ diff --git a/rpc/client.go b/rpc/client.go index 7e4ff35d..d2b1f5d0 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -61,7 +61,7 @@ type Client interface { GetPackedHeaderByNumber(ctx context.Context, number uint64) (*types.Header, error) // GetLiveCell returns the information about a cell by out_point if it is live. // If second with_data argument set to true, will return cell data and data_hash if it is live. - GetLiveCell(ctx context.Context, outPoint *types.OutPoint, withData bool) (*types.CellWithStatus, error) + GetLiveCell(ctx context.Context, outPoint *types.OutPoint, withData bool, include_tx_pool *bool) (*types.CellWithStatus, error) // GetTransaction returns the information about a transaction requested by transaction hash. GetTransaction(ctx context.Context, hash types.Hash, only_committed *bool) (*types.TransactionWithStatus, error) @@ -446,7 +446,7 @@ func (cli *client) VerifyTransactionAndWitnessProof(ctx context.Context, proof * return result, err } -func (cli *client) GetLiveCell(ctx context.Context, point *types.OutPoint, withData bool) (*types.CellWithStatus, error) { +func (cli *client) GetLiveCell(ctx context.Context, point *types.OutPoint, withData bool, include_tx_pool *bool) (*types.CellWithStatus, error) { var result types.CellWithStatus err := cli.c.CallContext(ctx, &result, "get_live_cell", *point, withData) if err != nil { diff --git a/rpc/client_test.go b/rpc/client_test.go index 129651b3..2c0cf27d 100644 --- a/rpc/client_test.go +++ b/rpc/client_test.go @@ -395,7 +395,7 @@ func TestClient_GetLiveCell(t *testing.T) { TxHash: types.HexToHash("0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37"), Index: 0, } - cellWithStatus, err := testClient.GetLiveCell(ctx, &outPoint, true) + cellWithStatus, err := testClient.GetLiveCell(ctx, &outPoint, true, nil) if err != nil { t.Fatal(err) }