Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.
This repository was archived by the owner on May 27, 2025. It is now read-only.

Handling Mixed Address UTXOs with Change Addresses #243

@Dawn-githup

Description

@Dawn-githup

Description

Currently, when changeIndex is not null, the change in satoshis is returned to:

  • changeAddress, if changeAddress is not null.

This works fine for single addresses but seems a bit odd when dealing with mixed address UTXOs.

Example Scenario

Let's illustrate with a real-world example:

  1. You need to pay 50 units.
  2. You only have 30 units.
  3. You borrow 20 units from me.
  4. I lend you a 50-unit note.
  5. You should return 30 units back to me as change.

Problem

In the context of UTXOs, if the borrowed 50-unit note is from a different address (mixed address UTXO), the system should be able to handle this by correctly returning the change to the lender’s address.

Proposal

To handle this scenario effectively, we suggest discussing whether to remove the restriction on changeAddress. This would allow the system to dynamically allocate the change to the appropriate address based on the UTXOs involved.

This adjustment will ensure that the returned change correctly reflects the source addresses, thereby improving the handling of mixed address UTXOs.


Metadata

Metadata

Assignees

No one assigned

    Labels

    P-LowwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions