Commit Graph

2 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun b11461fba7
chancloser: report proper final local balance in ChannelCloseSummary
Prior to this commit, the final close summary we added to the database
for the initiator of the channel was incorrect. This is due to the fact
that before, we would use the final snapshot to determine how many
coins the local party was delivered as a result of the cooperative
closure transaction. This is incorrect, as the local party pays fees on
the closure transaction if it’s the initiator.

To remedy this, we’ll now use the new return value of
CompleteCooperativeClose to properly note our final balance in the
database.
2018-01-08 19:50:21 -08:00
Olaoluwa Osuntokun 050500388c
chancloser: add new state machine to handle details of cooperative channel closure
In this commit, we add a new state machine to the project in order to
simplify and encapsulate the logic of negotiating the fees of the
closing transaction during the cooperative channel closure procedure.
This new implementation fixes several defects in the prior version of
the fee negotiation protocol as previously implemented within the peer.
Namely, we’ll now ensure that we converge to an acceptable fee
eventually, and clamp down the fee in the case that the starting fee is
greater than the fee of the commitment transaction.

The new fee negotiation also is very simple and should serve as a good
base for future improvements. After proposing our initial fee, if the
fee proposed by the remote party isn’t within 30% of our last fee, then
we increase/decrease our fee by 10%. This process continues until
either they send the same fee as we sent in a prior round, or they send
the identical fee that we sent in the last round.
2017-11-23 23:10:08 -06:00