3

If I modify account data more than once in one transaction, and I subscribe this account throw accountSubscribe or programSubscribe. If the transaction has been included in one block, could I receive the notification more than once with each modified data? Or I receive notification only once?

1
  • If I use two txs to modify account data twice, and the two txs are inclued in one block, could I receive two notification or the one notification with latest data of the account? Commented Feb 26 at 15:01

1 Answer 1

1

This was a more complicated question than expected! Looking through the code, it appears that you'll only get one notification per block about an account changing.

The pubsub service receives a notification at https://github.com/solana-labs/solana/blob/5f54f6a7d9739154591c1a454c16aa04c5cfdc64/rpc/src/rpc_subscriptions.rs#L773 and then fans them out to subscribers at https://github.com/solana-labs/solana/blob/5f54f6a7d9739154591c1a454c16aa04c5cfdc64/rpc/src/rpc_subscriptions.rs#L932 -- you'll see that there's only one notification for the new bank, and not on every single transaction that gets processed.

This means that you'll only get one update per slot, maximum. Note that I'm not an expert in this area of the code and may have misunderstood.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.