You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
platform-wallet: one-time funding key used by an external asset lock can be offered again after restart #5789
A wallet may hand out an identity funding key a second time after a restart, if that key was already used by an asset lock that the wallet did not build itself.
User story
As a wallet user, I want every one-time funding key to be used only once, to keep my identity funding private and avoid failed or linked registrations.
Scenario
Expected behavior
When any asset lock that the wallet sees pays Platform credits to one of its own one-time funding keys (identity registration, top-up or invitation), that key is stored as used. After a restart it is not offered again.
Actual behavior
Found by reading the code during review of #5787; not reproduced at runtime.
An asset lock built outside this wallet (for example, signed with the same seed in another app) can pay credits to a funding key that this wallet still holds as unused.
The SQLite store saves such a key only when it has no row yet (ON CONFLICT DO NOTHING, needed so a live snapshot never overwrites a newer stored reservation). An existing row stays unused.
After a restart the restored pool still offers the key as available, so the next identity registration, top-up or invitation can reuse it.
The wallet's own asset-lock builder marks its credit key used before broadcast, so this needs an externally built lock.
Open question: does key-wallet mark an address used when it appears only in an asset-lock payload's credit_outputs (not an ordinary output)? If not, the in-memory pool keeps the key Available too, and the gap exists independently of SQLite.
Possible fix: when a credit output of a seen asset lock matches an owned one-time funding key, mark that key used in both the in-memory pool and the store. Only move it toward used, never back to available, so a newer reservation is never lost. Add a restart regression with an externally built lock.
Impact: privacy (address reuse) and possibly a failed or linked identity operation. No loss of funds identified; no consensus change.
Activity