lnwallet: start of HTLC update logic
* moved sorting of transaction outside of createCommitTx also us to add HTLC’s before sorting * On the fence about the proxy object design, will re-visit once we start to implement the p2p code.
This commit is contained in:
1 parent
5a7b98a9e4
commit
1772108544
2 files changed
+247
-64
No files matched your search
+9
-2
@@ -788,19 +788,26 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
|
||||
ourCommitKey := ourContribution.CommitKey
|
||||
theirCommitKey := theirContribution.CommitKey
|
||||
ourCommitTx, err := createCommitTx(fundingTxIn, ourCommitKey, theirCommitKey,
|
||||
ourCurrentRevokeHash, theirContribution.CsvDelay, initialBalance)
|
||||
ourCurrentRevokeHash[:], theirContribution.CsvDelay,
|
||||
initialBalance, initialBalance)
|
||||
if err != nil {
|
||||
req.err <- err
|
||||
return
|
||||
}
|
||||
theirCommitTx, err := createCommitTx(fundingTxIn, theirCommitKey, ourCommitKey,
|
||||
theirContribution.RevocationHash, theirContribution.CsvDelay, initialBalance)
|
||||
theirContribution.RevocationHash[:], theirContribution.CsvDelay,
|
||||
initialBalance, initialBalance)
|
||||
if err != nil {
|
||||
req.err <- err
|
||||
return
|
||||
}
|
||||
|
||||
// Sort both transactions according to the agreed upon cannonical
|
||||
// ordering. This lets us skip sending the entire transaction over,
|
||||
// instead we'll just send signatures.
|
||||
txsort.InPlaceSort(ourCommitTx)
|
||||
txsort.InPlaceSort(theirCommitTx)
|
||||
|
||||
// Record newly available information witin the open channel state.
|
||||
pendingReservation.partialState.CsvDelay = theirContribution.CsvDelay
|
||||
pendingReservation.partialState.TheirDeliveryAddress = theirContribution.DeliveryAddress
|
||||
|
||||
Reference in new issue
Block a user