Skip to content

migration algorithm exits without processing all inputs. #85

Description

@KtorZ

Context

The migration algorithm is an iterative algorithm, which attempts to construct several coin selections in order to deplete a wallet. An initial "ideal batch size" is calculated beforehand, and then, the algorithm proceed to construct selections from batch of inputs of that ideal size (modulo the last batch).

Constructing a selection also means balancing it. Here, the algorithm will depletes change outputs until reaching an equilibrium and will take care of filtering out dust coins that are below a certain threshold.

There are cases where a given selection could not produce any value (all change output are below the threshold).

Expected Behavior

The algorithm should discard such "no-value" selections, and continue processing next batches until it has traversed all batches.

Current Behavior

The algorithm stops at the first "no-value" selections and returns, with whatever selections has been accumulated this far, possibly leaving many inputs behind.

Resolution

https://github.com/input-output-hk/cardano-coin-selection/blob/cff368d674fe58bc1a12e6564a26ccea21eb5aac/src/library/Cardano/CoinSelection/Algorithm/Migration.hs#L108-L112

The issue is the handling of the Nothing branch ☝️ which should not be pure [] (terminal case of the recursion) but simply migrate, discarding the ongoing selection, but continuing migrating others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions