Skip to content

Conversation

@cjamthagen
Copy link
Contributor

Currently non-HTLC outputs will be accepted in the commitment
transaction as long as it is non-zero. We change this by not allowing
outputs with a value lower than the dust limit. The value of such
an output will go towards transaction fees.

@cjamthagen
Copy link
Contributor Author

Updated to have ForceClose and the utxonursery handle to-self dust.

@andrewshvv
Copy link
Contributor

@cjamthagen Sorry for not being too much responsive on your PRs! We will try find more time on this week, thanks!

@Roasbeef Roasbeef force-pushed the master branch 2 times, most recently from d86107c to a34df2f Compare February 8, 2017 04:54
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a function to estimate the current dust limit within the wallet. It can be used here in place of the hard-coded amount.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found several more of these occurrences. All should be fixed now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here about removing the magic number.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, the utxoNursery will also need to be modified to ignore outputs that have a nil SignDescriptor. Atm, if a sub-dust output were some how still created, a panic would occur.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This also fixes an existing bug atm which can arise if a channel is forced closed with uncleared HTLC's

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When easy, lines in files should be folded to 80-characters. Thanks!

utxonursery.go Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is triggering a panic in the integration tests. The incReq struct needs to be properly initialized:

var inqReq incubationRequest

Then:

u.requests <- &incReq

@cjamthagen cjamthagen force-pushed the no_dust_outputs branch 2 times, most recently from c4f0bb0 to 0f54d49 Compare February 23, 2017 07:32
@Roasbeef Roasbeef added this to the v0.2-alpha milestone Mar 1, 2017
Currently non-HTLC outputs will be accepted in the commitment
transaction as long as it is non-zero. We change this by not allowing
outputs with a value lower than the dust limit. The value of such
an output will go towards transaction fees.
If the value of the to-local output is below the dust limit, the
ForceCloseSummary should not include a sign descriptor for this output.

We also find the proper to-self output by looking for the expected public
key script and not assume that no HTLC outputs exist.
If a forceClose happens and the to-self output is below the dust value,
then that output will be non-existant in the commitment transaction.
UtxoNursery now handles that case by checking to see if the accompanying
selfOutPutSignDescriptor is nil. If it is nil, then it will ignore it.
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested everything locally, and all the functionality appears to be in order. Thanks for this PR! This puts us a bit closer towards full compliance w.r.t to the current draft specification.

LGTM 👾

@Roasbeef Roasbeef merged commit 242c656 into lightningnetwork:master Mar 9, 2017
@ABISprotocol
Copy link

ABISprotocol commented Jun 2, 2017

With BIP-199 in draft, does this imply that HTLC outputs (w / dust) as described in the merge at #84 cannot yet be supported / implemented in the bitcoin network until such time as BIP-199 is final? Or can the dust be handled today? Please clarify.

@andrewshvv
Copy link
Contributor

andrewshvv commented Jun 2, 2017

@ABISprotocol , I will try to explain it from my point of understanding: HTLC - is a special output in commitment transaction which is present in it till both sides agreed on successfulness of the payment (R value have been exchanged, and new state have been updated on both sides). If payment/htlc amount is too small, than such output is called dust. If for some reason channel have been force closed during payment, and dust htlc/payment haven't been settled (both sides haven't agreed to remove the htlc and change the balances accordingly), than we not include it in commitment transaction (thereby give them as a fee to miners) in order to make it valid.

@ABISprotocol
Copy link

Thanks for this clarification @AndrewSamokhvalov , I am also currently observing a pull request (in some ways related) here: bitcoin/bitcoin#7601

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants