Skip to content

Stale OrderBookDB entries remain in memory after AMMDelete #6665

@mvadari

Description

@mvadari

Issue Description

In AMMCreate::doApply (src/libxrpl/tx/transactors/dex/AMMCreate.cpp, lines ~280–287), order books are added to the in-memory OrderBookDB:

ctx_.registry.getOrderBookDB().addOrderBook(book);

However, AMMDelete never removes these entries from the OrderBookDB. The in-memory DB is rebuilt from the ledger on node restart, so the stale entries are transient and self-healing. However, between deletion and restart, the stale entries may trigger unnecessary subscription notifications for empty book sides.

Steps to Reproduce

  1. Create an AMM (which adds entries to OrderBookDB).
  2. Delete the AMM via AMMDelete.
  3. Observe that the OrderBookDB still contains the AMM's order book entries until the next server restart.

Expected Result

AMMDelete should remove the corresponding order book entries from OrderBookDB when deleting an AMM, similar to how AMMCreate adds them.

Actual Result

Stale order book entries persist in OrderBookDB until the server restarts and rebuilds the DB from the ledger.

Environment

All versions with AMM support (XLS-30).

Supporting Files

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI TriageBugs and fixes that have been triaged via AI initiatives

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions