<!-- XE-16991 · [Low] MemStore dest index returns a stale copy after re-putting a pending under a different destination · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16991>. The page is the record; this is the same page for reading.*

XE-16991 · Bounty

# \[Low\] MemStore dest index returns a stale copy after re-putting a pending under a different destination

Closed · duplicate
—
[xe#702](https://github.com/xeprotocol/xe/issues/702)
filed 2026-11-17 08:12 UTC
by kecedanzz77-bit

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   Leasing / ledger

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-22 23:26 UTC

Told
:   2026-11-22 23:26 UTC

### Patches

None linked.

### History

- [770266](https://bounty.xe.network/log/770266) 2026-11-22 23:26 UTC reply.mirror\_failed
- [769964](https://bounty.xe.network/log/769964) 2026-11-22 23:26 UTC proposal.adopted
- [769963](https://bounty.xe.network/log/769963) 2026-11-22 23:26 UTC reply.sent
- [769962](https://bounty.xe.network/log/769962) 2026-11-22 23:26 UTC ticket.status new → closed
- [769012](https://bounty.xe.network/log/769012) 2026-11-22 23:25 UTC proposal.adopted
- [769011](https://bounty.xe.network/log/769011) 2026-11-22 23:25 UTC ticket.facts area
- [769010](https://bounty.xe.network/log/769010) 2026-11-22 23:25 UTC proposal.adopted
- [769009](https://bounty.xe.network/log/769009) 2026-11-22 23:25 UTC ticket.facts
- [769008](https://bounty.xe.network/log/769008) 2026-11-22 23:25 UTC proposal.adopted
- [769007](https://bounty.xe.network/log/769007) 2026-11-22 23:25 UTC ticket.facts
- [766420](https://bounty.xe.network/log/766420) 2026-11-22 23:17 UTC note.added
- [766409](https://bounty.xe.network/log/766409) 2026-11-22 23:17 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-16991) · [JSON](https://bounty.xe.network/v1/tickets/XE-16991) · [markdown](https://bounty.xe.network/XE-16991.md)

### Report

## Summary

Re-putting a pending under a different destination: MemStore's dest index returns a stale copy, BadgerStore returns the live record. MemStore's `pendingByDest` stores *copies*; re-putting the same `SendHash` with a new destination creates a new copy under the new dest and leaves the old dest entry pointing at the old copy.

## Root Cause

- MemStore's `pendingByDest` stores copies (`store/mem_store.go:147-157`): re-putting the same `SendHash` with a new destination creates a new copy under the new dest and leaves the old dest entry pointing at the old copy.
- BadgerStore's dest index stores only hashes, resolved live via `GetPendingSend` (`store/badger_store.go:430-460`).

## Verification

Executed differential harness (test A5): `PutPendingSend(hash H, dest B, amount 50)`, then `PutPendingSend(hash H, dest C, amount 70)`.

```
GetPendingByDest(B): Mem = 1 entry, amount 50, dest B (stale)
                     Badger = 1 entry, amount 70, dest C (current record)
GetPendingSend(H) agrees (70/C) on both.
```

Same test-only caveat as the sibling aliasing report: `PutPendingSend` has no production callers (a `SendHash` is a block hash, added once in production), plus a contrived trigger (re-put with changed destination). Low.

## Note on related reports

Searched `stale pending destination` (#229, #395, #97, #155 — all different mechanisms; #229 is a conflict-swap plan→apply race) and `pendingByDest` (0 hits). Distinct from #226 V4: that is about Badger *duplicate membership* in the dest list; this is about the *content* MemStore returns from its copy-based dest index (membership count is 1 on both sides here).

## Suggested fix

Resolve dest-index lookups against the primary map (store hashes, not copies), matching BadgerStore.

### Thread

**Joseph Denne**team2026-11-22 23:26 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-16991 and says what differs; it is read like any other.
