diff --git a/docs/protocol.md b/docs/protocol.md index 4d984e3..694fa6b 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -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 diff --git a/packages/wallet/src/wallet-connection-manager.ts b/packages/wallet/src/wallet-connection-manager.ts index 357cced..a437980 100644 --- a/packages/wallet/src/wallet-connection-manager.ts +++ b/packages/wallet/src/wallet-connection-manager.ts @@ -290,8 +290,11 @@ export class WalletConnectionManager extends EventEmitter