Skip to content
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

ws client duplicate transactions #357

Open
jxad opened this issue May 11, 2023 · 2 comments
Open

ws client duplicate transactions #357

jxad opened this issue May 11, 2023 · 2 comments

Comments

@jxad
Copy link

jxad commented May 11, 2023

Im using the websocket client on MagicEden program logs

from solana.rpc.websocket_api import (
   connect, 
   RpcTransactionLogsFilterMentions,
)

async def main():
   async with connect(RPC_WS_ENDOINT) as wsClient:
      await wsClient.logs_subscribe(filter_=RpcTransactionLogsFilterMentions(MagicEden.program_address))
      first_resp = await wsClient.recv()
      me_log_sub_id = first_resp[0].result
      async for _, res in enumerate(wsClient):
         data = res[0]
         print(data.result.value.signature)
      await wsClient.logs_unsubscribe(me_log_sub_id)      

asyncio.run(main())

This generates lots of duplicate responses
txs logs

am I missing something?

@mfrager
Copy link

mfrager commented May 16, 2023

You're most likely getting the 1st message when the transaction reached "committed" status, then another when it is "finalized". Try setting: commitment='confirmed' in logs_subscribe()

@jxad
Copy link
Author

jxad commented May 17, 2023

My bad, I haven't included the Confirmed configuration, and I'm still getting duplicated transactions. As you said, it seems that I'm receiving the transaction when it's confirmed and then finalized.

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

No branches or pull requests

2 participants