-
Notifications
You must be signed in to change notification settings - Fork 31
[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
base: master
Are you sure you want to change the base?
[WIP]Indexer #524
Conversation
func (i *indexerService) GetCommitmentTxInfo( | ||
ctx context.Context, txid string, | ||
) (*CommitmentTxResp, error) { | ||
round, err := i.repoManager.Rounds().GetRoundWithTxid(ctx, txid) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This implements rpc’s from indexer.proto and adds those methods to sdk client(grpc/rest)
@altafan please review.