{"id":"XE-10134","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":730,"title":"Pending Send List Duplication: PutPendingSend and CommitUndo omit deduplication on destination index causing phantom duplicate receives","area":"leasing-ledger","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0135","tracked":true,"internal_ref":"#1064","internal_url":"https://github.com/xeprotocol/core/issues/1064","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-12T10:10:13.289516+00:00","updated_at":"2026-11-20T00:33:20.018700+00:00","source_created_at":null,"told_at":"2026-11-20T00:33:20.038615+00:00","status_changed_at":"2026-11-20T00:33:20.026150+00:00","url":"https://bounty.xe.network/XE-10134","body":"## Vulnerability Summary\n\nIn `store/badger_store.go:224-232` and `1060-1070` (and `store/mem_store.go:120-135`), `PutPendingSend` and `CommitUndo.AddPending` index pending transactions by destination account:\n\n```go\n\t\tdestKey := prefixedKey(prefixPendingDst, ps.Destination)\n\t\tvar hashes []string\n\t\titem, err := txn.Get(destKey)\n\t\tif err != nil && err != badger.ErrKeyNotFound {\n\t\t\treturn err\n\t\t}\n\t\tif err == nil {\n\t\t\tif err := item.Value(func(val []byte) error {\n\t\t\t\treturn json.Unmarshal(val, &hashes)\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\thashes = append(hashes, ps.SendHash)\n\t\tdestData, err := json.Marshal(hashes)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn txn.Set(destKey, destData)\n```\n\nNotice that `hashes = append(hashes, ps.SendHash)` unconditionally appends the send block hash to the destination's pending list slice without deduplication:\n1. Idempotency Failure: If `PutPendingSend` is executed more than once for the same send transaction (e.g. during p2p block synchronization re-runs, block re-announcements, or cascade reorg rollbacks), the transaction hash is appended multiple times: `[\"sendHashA\", \"sendHashA\"]`.\n2. Duplicate API & CLI Responses: `GetPendingByDest` iterates through `hashes` and fetches each item via `GetPendingSend(h)`. It returns a slice containing duplicate `*core.PendingSend` records to API callers (`GET /pending/{address}`).\n3. Client Double-Receive Conflict: Automated client tools and CLI (`xe receive`) iterate over `c.GetPending(addr)` and attempt to construct and submit multiple `BlockReceive` blocks referencing the same send hash, causing transaction rejection or self-fork conflicts.\n\n## Proposed Remediation\n\nIn `store/badger_store.go` and `store/mem_store.go`, ensure `hashes` is deduplicated before appending:\n```go\n\t\talreadyPresent := false\n\t\tfor _, h := range hashes {\n\t\t\tif h == ps.SendHash {\n\t\t\t\talreadyPresent = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !alreadyPresent {\n\t\t\thashes = append(hashes, ps.SendHash)\n\t\t}\n```","patch_refs":[],"thread":[{"id":13242,"source":"desk","source_ref":"reply:11264","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0135, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-10134 and says what differs; it is read like any other.","created_at":"2026-11-20T00:33:20.018700+00:00"}]}