-
Notifications
You must be signed in to change notification settings - Fork 3
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
CPFP #3
Comments
Now that I think about it, I can definitely do this calculation outside of the library haha. |
But I still need a way to coinselect for only one output: the change. |
Thank you for your message. I would need to make sure I fully undestand the approach you're planning to implement outside of the library. Regarding I would need a more detailed explanation of your specific requirements. |
The goal is to bump a previous transaction fee using Child Pay For Parent. So, I need to build a transaction that spends given (unconfirmed) UTXOs to a single change target. The current
What would be necessary to do a proper CPFP:
What we could do would be:
Thinking about it, we could even replace Is that clearer? |
That's the part I don't understand. You can already use maxFunds with an empty array of targets. And then pass your change to See, for example: coinselect/test/fixtures/maxFunds.json Line 41 in b568bf8
|
Sure but it doesn't select UTXOs, it spends all of them. For example, I have a 1000 sats anchor output I want to spend to bump the transaction fees. 1000 sats isn't enough to pay for the high fees, so I need to add some UTXOs to the inputs, and I need to select these UTXOs. |
I see. So this is a tx you want to unstuck by sending it back completely to yourself. Right? What about using You could add the values of these two targets together. Then, build a transaction using only the real target address but using the sum of the 2 targets as value. Of course, If desired, you can adjust this by adding back the excess fee to the real output, with something like this: |
What about the extra input for the anchor? I'm sure I could get it done with some tricky workarounds (like I am currently doing), but it feels like it would be nice to get this natively? If we settle on an API, I can make a PR 👍 |
Hey! I'm trying to use this to build a transaction that CPFP another one. It could be useful to have an option to specify the previous transaction fee rate, so the algorithm can take it into account. I can add this, but would need to check with you @landabaso the best way to do it. We need to know the previous transaction fee rate, so we can compute a new fee rate from the given fee rate and the previous one:
newFeeRate = 2 * feeRate - previousFeeRate
(withfeeRate
>previousFeeRate
otherwise it wouldn't bump anything). Then use that new fee rate as replacement of the input fee rate in the algos.The text was updated successfully, but these errors were encountered: