-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling Mixed Address UTXOs with Change Addresses #243
Comments
The current logic of the if (changeAddress && changeAddress !== outputs[changeIndex].address) {
throw TxBuildError.withComment(
ErrorCodes.INVALID_CHANGE_OUTPUT,
`The address of outputs[${changeIndex}] does not match the specified changeAddress, expected: ${changeAddress}, actual: ${outputs[changeIndex].address}`,
);
} However, from another perspective, if the RBF transaction is sponsored by another address, it is also reasonable to return the change to the RBF sponsor instead of the original change address, since the RBF sponsor may provide a large UTXO to the RBF transaction. In this situation, by removing the restriction for the Worth mentioning, though, the RBF transaction can be fairly complex:
|
Usually, the |
Another option is to do nothing about it, because the restriction mentioned above only applies when Basically the restriction ensures that the change output to the original change address exists in the RBF transaction. |
Description
Currently, when
changeIndex
is not null, the change in satoshis is returned to:changeAddress
, ifchangeAddress
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:
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.
The text was updated successfully, but these errors were encountered: