-
Notifications
You must be signed in to change notification settings - Fork 4
Add tryGetFundsFromRemoteCommitmentTx + bugfixes #23
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
Add tryGetFundsFromRemoteCommitmentTx + bugfixes #23
Conversation
This has been fixed. |
|
Hey @canndrew, can you:
|
BTW, what's the effect of this patch above not being in m1/m2? |
fc2ef93 to
b648f94
Compare
|
I've applied the requested changes and force-pushed.
Nothing, as far as I'm aware. I only became aware that the function is buggy once I went to use it. |
And what's the effect of the bug? If there's no effect, there's no bug. |
why? cannot we add this API to NBitcoin?
Please use UPPERCASE for acronyms (in the commit message).
If requiresCpfp parameter causes fee to be increased, then it's not a good name for the parameter. How about |
4eb7b47 to
c6fe98d
Compare
Here's the definition of the type. Note that this type is supposed to represent a fee per weight. Which is being changed to: I'm pretty sure the only reason this didn't come up earlier is that we were never using this function.
Possibly. But it's easier to change the function so that we pass it the destination and fee rate, rather than mess around with the (very abstruse) internals of
Fixed.
Fixed. I've amended the commit to make him the author. |
So this function is only used for CPFP? That's kinda surprising because looks generic enough.
If you agreed to the above, this still makes me scratch my head sorry. How much is the increase? it looks very subjective.
Well, if you mess arounds with the internals of TransactionBuilder and the maintainer of NBitcoin merges your PR, it gives me more confidence than suddenly make this little code flow here use |
|
BTW regarding the 1st commit:
|
That function isn't the only way to construct a
It's not subjective. It's whatever the deficit is in the fee of the commitment transaction. If the commitment transaction has a fee of A, but it needs to offer a fee of B to get mined (based on the current fee rate) then we'll add (B - A) to the recovery tx fee.
What do you mean by "all other places"? We use the |
Let's put this as a comment on top of the cpfp parameter.
Whenever I've seen the Transaction type being used I've always told you to use TransactionBuilder instead. Please let me know all the places where I forgot. |
Sorry, but what are you actually asking for here? The only reason this function originally returned a
to this: But I don't see how that offers a marked improvement.
|
It looks like that macaroons random failure again, so not related to the commit. I'll re-run to see what it does. Edit: It passed.
That patch allows us force-close channels and recover the funds. The first commit here allows us to recover funds from remotely force-closed channels. |
|
I said in the past that I've had many problems with the API of Transaction and I'd prefer to use TransactionBuilder everywhere. In many cases where you were even skeptic that you could do this, I've done the changes myself and it has worked.
What I'm saying is that if you need a |
c06e678 to
6db7834
Compare
|
@canndrew one last thing, can you move the commit titled |
e141e3c to
d37176a
Compare
This version enables setting transaction input sequence numbers and the transaction version number through TransactionBuilder Also Fix commitment number discovery in tryGetFundsFromLocalCommitmentTx. This function would erroneously assume that we are the funder and would fail to recover funds if the fundee tried to use it. Also amend the function to use the new sequence number and version setting capabilities of NBitcoin.
This function recovers funds from the to_remote output of a remote commitment tx which has been broadcast to the blockchain. This allows us to recover funds from a channel that has been force-closed by the remote peer.
Also pass a `increaseFeeToRaiseCpfpIncentive` argument to both fund-recovery functions so that CPFP can be explicitly requested. If the commitment tx is lingering in the mempool then this can be set to `true` to increase the chance of it being mined. Otherwise, if the commitment tx has already been mined then this can be set to `false` to avoid paying a larger fee.
FeeRatePerKw.FromFee was mis-calculating the fee rate from the fee and weight.
8adbbc7 to
b7e3fb7
Compare
|
@knocte: Done. |
|
This PR has been replaced by #25. |
This PR adds the
tryGetFundsFromRemoteCommitmentTxand provides several bugfixes.