Skip to content

CoinsToSpend query should return selected coins even if the amount cannot be covered #2898

@rafal-ch

Description

@rafal-ch

Currently, when the CoinsToSpend query cannot find enough coins it returns an error:

    #[error("the target cannot be met due to no coins available or exceeding the {max} coin limit.")]
    InsufficientCoinsForTheMax {
        asset_id: AssetId,
        collected_amount: u128,
        max: u16,
    },

The new behavior should be:

  1. add new field to the query, for example: allow_partial: bool. If this field is set to true, then:
    • do not return an error
    • return coins that we were able to find even if they do not satisfy the query

Definition of Done:

  1. InsufficientCoinsForTheMax error is never thrown (from both indexed and non-indexed coins to spend algorithm implementations) if the new flag is set
  2. Tests are updated to cover system behavior with this new flag
  3. Indexation documentation is updated: https://www.notion.so/fuellabs/Indexation-1932f2293f31806b87c1ef8160d3acd7

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions