Skip to content

Commit

Permalink
no filter case
Browse files Browse the repository at this point in the history
  • Loading branch information
anjor committed Nov 18, 2024
1 parent 4085deb commit 60bbd95
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions grpc-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,32 +708,24 @@ func (multi *MultiEpoch) StreamTransactions(params *old_faithful_grpc.StreamTran
endSlot = *params.EndSlot
}

filterFunc := func(tx *old_faithful_grpc.Transaction) bool {
if params.Filter == nil || len(params.Filter.AccountInclude) == 0 {
return true
}

return txContainsAccounts(tx, params.Filter.AccountInclude)
}

for slot := startSlot; slot <= endSlot; slot++ {
select {
case <-ctx.Done():
return ctx.Err()
default:
}

block, err := multi.GetBlock(ctx, &old_faithful_grpc.BlockRequest{Slot: slot})
if err != nil {
if status.Code(err) == codes.NotFound {
continue // is this the right thing to do?
if params.Filter == nil || len(params.Filter.AccountInclude) == 0 {
block, err := multi.GetBlock(ctx, &old_faithful_grpc.BlockRequest{Slot: slot})
if err != nil {
if status.Code(err) == codes.NotFound {
continue // is this the right thing to do?
}
return err
}
return err
}

for _, tx := range block.Transactions {
if filterFunc(tx) {
if err := ser.Send(constructTransactionResponse(tx)); err != nil {
for _, tx := range block.Transactions {
if err := ser.Send(constructTransactionResponse(tx, block)); err != nil {
return err
}
}
Expand All @@ -743,13 +735,11 @@ func (multi *MultiEpoch) StreamTransactions(params *old_faithful_grpc.StreamTran
return nil
}

func txContainsAccounts(tx *old_faithful_grpc.Transaction, accounts []string) bool {
return true
}

func constructTransactionResponse(tx *old_faithful_grpc.Transaction) *old_faithful_grpc.TransactionResponse {
// to do
func constructTransactionResponse(tx *old_faithful_grpc.Transaction, block *old_faithful_grpc.BlockResponse) *old_faithful_grpc.TransactionResponse {
return &old_faithful_grpc.TransactionResponse{
Transaction: tx,
BlockTime: block.BlockTime,
Slot: block.Slot,
// What to do for index?
}
}

0 comments on commit 60bbd95

Please sign in to comment.