Dedup connection: conn.dappDiscovered = false;

This commit is contained in:
jakobsn 2026-04-03 12:35:50 +00:00 committed by Dagur Valberg Johannsson
parent 077236969a
commit e852e70a8e
2 changed files with 9 additions and 3 deletions

View file

@ -121,8 +121,11 @@ a ready message from the other side in this runtime session."
"ready" — *even if it already sent one* — because the other side has lost state and needs
a fresh delivery.
4. The wallet guards against duplicate `wallet_ready` messages within a single connection cycle
via `walletReadySentThisCycle`. This resets to `false` on each new connect/reconnect.
Receiving `dapp_ready(wallet_discovered=false)` also resets this flag.
via `walletReadySentThisCycle`. Both `walletReadySentThisCycle` and `dappDiscovered` reset to
`false` on each new connect/reconnect. This ensures the wallet always sends
`wallet_ready(dapp_discovered=false)` at the start of a new connection cycle, matching the
"Wallet reconnects" scenario. Receiving `dapp_ready(wallet_discovered=false)` also resets
`walletReadySentThisCycle`.
#### Scenarios

View file

@ -290,8 +290,11 @@ export class WalletConnectionManager extends EventEmitter<WalletConnectionManage
}
private onConnected(conn: ActiveConnection): void {
// New connection cycle: reset dedup flag so wallet_ready is sent fresh
// New connection cycle: reset dedup flags so wallet_ready is sent fresh
// and dapp_discovered is false — the dapp must re-send dapp_ready to
// re-establish the session (matches "Wallet reconnects" scenario in protocol.md).
conn.walletReadySentThisCycle = false;
conn.dappDiscovered = false;
// Start notification processor as fallback for retries after send errors
if (conn.notificationProcessor) {