Skip to content

Inputs nor outputs are returned when a certain condition is met #75

@sondreb

Description

@sondreb

If I understand this correctly, I shouldn't rely on the fee value returned unless either inputs or outputs are returned? Here is from the README example:

// .inputs and .outputs will be undefined if no solution was found
if (!inputs || !outputs) return

There is only a single UTXO provided to the coinselect and it runs to the following line, which makes it continue out of the loop and go to the bottom where only fee is returned:

if ((inAccum + inputValue) > (outAccum + fee + threshold)) continue

That results in both inputs and outputs being empty, which are only supplied if finalize is ever called, which in the case you have a single UTXO that has enough for output and fee.

return { fee: feeRate * bytesAccum }

Is this expected behavior, that inputs and outputs will be empty in a scenario like this and is the example misleading, or do I have other issues with the provided input data?

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