Skip to content

Inability to check if utxo belongs to an address #766

@Fiftyw3bs

Description

@Fiftyw3bs

I've been struggling with a very weird phenomenon.

I have a validator, whose UTXO I'm trying to spend/pay to the invoking wallet address.

Mesh is being used for building the transaction, while the validator is written in aiken.

There is a function that's suppose to check if a certain amount is being paid to an address, but my validator keeps failing unless I omit the address comparison expression:

pub fn value_paid_to_address(
  policy_id: PolicyId,
  name: AssetName,
  value: Int,
  addr: Address,
  outputs: List<Output>,
) -> Bool {
  outputs
    |> list.any(
        fn(output) { quantity_of(output.value, policy_id, name) == value && output.address == addr},
      )
}

Removing output.address == addr works.

An excerpt of the transaction is as follows, which clearly shows that the value is being paid to the address:

{
    ...
    "outputs": [
        {
            "address": "addr_test1qpywx....hw64n788msj4ugzgag2sjg7h48us77k3p4kgc7sutsa7gdk56hcqqlqhrlnw6lxsh4dp4a",
            "amount": [
                {
                    "unit": "29e18c9c2b4a0350aed8069...60a0ac1808a7453485348",
                    "quantity": "1"
                }
            ],
            "datum": null,
            "referenceScript": null
        }
    ],
    ...
}

Has anyone ever encountered such issue? Any assistance rendered would be greatly appreciated.

Mesh: v1.8.0
Aiken: v1.1.17

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions