Skip to content

[WIP]Indexer #524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open

[WIP]Indexer #524

wants to merge 33 commits into from

Conversation

sekulicd
Copy link
Collaborator

@sekulicd sekulicd commented Apr 8, 2025

This implements rpc’s from indexer.proto and adds those methods to sdk client(grpc/rest)

@altafan please review.

func (i *indexerService) GetCommitmentTxInfo(
ctx context.Context, txid string,
) (*CommitmentTxResp, error) {
round, err := i.repoManager.Rounds().GetRoundWithTxid(ctx, txid)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API can take time if the database and the round are big, we should use an ad hoc api that basically returns the data as defined in the proto.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

func (i *indexerService) GetForfeitTxs(ctx context.Context, req ForfeitTxsReq) (*ForfeitTxsResp, error) {
round, err := i.repoManager.Rounds().GetRoundWithTxid(ctx, req.BatchOutpoint.Txid) //TODO batch thing
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make use of an ad hoc API GetRoundForfeitTxs that returns only the list of forfeit txids for a given round txid

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

func (i *indexerService) GetConnectors(ctx context.Context, req ConnectorsReq) (*ConnectorResp, error) {
round, err := i.repoManager.Rounds().GetRoundWithTxid(ctx, req.BatchOutpoint.Txid) //TODO batch thing
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, we can make use of an ad hoc GetRoundConnectorTree

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

func (i *indexerService) GetTransactionHistory(ctx context.Context, req TxHistoryReq) (*TxHistoryResp, error) {
allVtxos, err := i.repoManager.Vtxos().GetAll(ctx)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make use of an ad hoc API GetVtxosWithPubKey instead of getting the whole vtxo set and then filter by pubkey. The code to extract the pubkey from the address can be taken from the func above

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -140,3 +140,142 @@ type TxRequestInfo struct {
Cosigners []string
LastPing time.Time
}

type VtxoTreeReq struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we please drop all these *Req structs? I'm ok with the resp ones, but anyway, this indexer will stay here only for a bit hopefully... let's have the less possible impact in terms of changes to existing files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

func (i *indexerService) GetVirtualTxs(ctx context.Context, req VirtualTxsReq) (*VirtualTxsResp, error) {
vtxos, err := i.repoManager.Vtxos().GetAll(ctx)
Copy link
Collaborator

@altafan altafan Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make use of the newly defined API GetTxsWithTxids.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants