Skip to content

Comments

Fix poll vote decryption issue #1344#2369

Open
kobie3717 wants to merge 2 commits intoWhiskeySockets:masterfrom
kobie3717:fix/poll-vote-decryption
Open

Fix poll vote decryption issue #1344#2369
kobie3717 wants to merge 2 commits intoWhiskeySockets:masterfrom
kobie3717:fix/poll-vote-decryption

Conversation

@kobie3717
Copy link

Summary

Fixes #1344 where getAggregateVotesInPollMessage() returns nothing.

Root Cause

The poll vote decryption logic in src/Utils/process-message.ts was commented out with TODO comments indicating it should be removed. This meant that poll votes were never decrypted and added to the message's pollUpdates array, causing getAggregateVotesInPollMessage() to return empty results.

Changes Made

  1. Uncommented poll vote decryption logic - Restored the essential code that decrypts poll votes when pollUpdateMessage is received
  2. Improved LID vs JID handling - Added proper handling for Local Identifiers (LID) vs Jabber Identifiers (JID) which was causing issues in groups
  3. Enhanced error handling - Added validation for missing messageSecret and better debugging logs
  4. Fixed TypeScript issues - Used toNumber() helper instead of direct Long casting

How the Fix Works

  • When a pollUpdateMessage is received, the code now:
    1. Fetches the original poll creation message using getMessage()
    2. Extracts the encryption key (messageSecret) from the poll creation message
    3. Properly identifies the voter JID, handling LID vs JID mismatches
    4. Decrypts the vote using the existing decryptPollVote() function
    5. Emits a messages.update event with the decrypted poll updates
  • This allows getAggregateVotesInPollMessage() to aggregate the votes properly

Testing

Backward Compatibility

  • No breaking changes
  • Restores functionality that was previously working but was disabled

Closes #1344

root added 2 commits February 24, 2026 07:35
- Add max size limits to all NodeCache instances in the codebase
- msgRetryCache: limit to 10k entries (from unbounded)
- callOfferCache: limit to 1k entries (from unbounded)
- placeholderResendCache: limit to 5k entries (from unbounded)
- identityAssertDebounce: limit to 1k entries (from unbounded)
- userDevicesCache: limit to 5k entries (from unbounded)
- peerSessionsCache: limit to 5k entries (from unbounded)
- signal store cache: limit to 10k entries (from unbounded)

These caches previously only had TTL cleanup but no size bounds,
which could lead to unbounded memory growth in high-traffic scenarios.
The size limits prevent memory leaks while maintaining performance.

Fixes WhiskeySockets#2344
- Uncommented poll vote decryption logic that was disabled
- Added better LID vs JID handling for group polls
- Improved error logging and validation
- Fixed missing messageSecret check
@whiskeysockets-bot
Copy link
Contributor

Thanks for opening this pull request and contributing to the project!

The next step is for the maintainers to review your changes. If everything looks good, it will be approved and merged into the main branch.

In the meantime, anyone in the community is encouraged to test this pull request and provide feedback.

✅ How to confirm it works

If you’ve tested this PR, please comment below with:

Tested and working ✅

This helps us speed up the review and merge process.

📦 To test this PR locally:

# NPM
npm install @whiskeysockets/baileys@kobie3717/Baileys#fix/poll-vote-decryption

# Yarn (v2+)
yarn add @whiskeysockets/baileys@kobie3717/Baileys#fix/poll-vote-decryption

# PNPM
pnpm add @whiskeysockets/baileys@kobie3717/Baileys#fix/poll-vote-decryption

If you encounter any issues or have feedback, feel free to comment as well.

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.

[BUG] getAggregateVotesInPollMessage() didnt return anything

2 participants