mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-23 14:40:30 +01:00
lnwallet: update to 20 byte revocation hashes
This commit is contained in:
parent
f49da92a4e
commit
c41f7d1a7d
2 changed files with 4 additions and 9 deletions
|
@ -36,7 +36,7 @@ type ChannelContribution struct {
|
||||||
|
|
||||||
// Hash to be used as the revocation for the initial version of this
|
// Hash to be used as the revocation for the initial version of this
|
||||||
// party's commitment transaction.
|
// party's commitment transaction.
|
||||||
RevocationHash [wire.HashSize]byte
|
RevocationHash [20]byte
|
||||||
|
|
||||||
// The delay (in blocks) to be used for the pay-to-self output in this
|
// The delay (in blocks) to be used for the pay-to-self output in this
|
||||||
// party's version of the commitment transaction.
|
// party's version of the commitment transaction.
|
||||||
|
|
|
@ -601,7 +601,7 @@ func (l *LightningWallet) handleFundingReserveRequest(req *initFundingReserveMsg
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
reservation.partialState.OurShaChain = shaChain
|
reservation.partialState.OurShaChain = shaChain
|
||||||
ourContribution.RevocationHash = shaChain.CurrentRevocationHash()
|
copy(ourContribution.RevocationHash[:], shaChain.CurrentRevocationHash())
|
||||||
|
|
||||||
// Funding reservation request succesfully handled. The funding inputs
|
// Funding reservation request succesfully handled. The funding inputs
|
||||||
// will be marked as unavailable until the reservation is either
|
// will be marked as unavailable until the reservation is either
|
||||||
|
@ -720,11 +720,6 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
|
||||||
// transaction. Only signatures will be exchanged.
|
// transaction. Only signatures will be exchanged.
|
||||||
txsort.InPlaceSort(pendingReservation.partialState.FundingTx)
|
txsort.InPlaceSort(pendingReservation.partialState.FundingTx)
|
||||||
|
|
||||||
// Now that the transaction has been cannonically sorted, compute the
|
|
||||||
// normalized transation ID before we attach our signatures.
|
|
||||||
// TODO(roasbeef): this isn't the normalized txid, this isn't recursive...
|
|
||||||
// pendingReservation.normalizedTxID = pendingReservation.fundingTx.TxSha()
|
|
||||||
|
|
||||||
// Next, sign all inputs that are ours, collecting the signatures in
|
// Next, sign all inputs that are ours, collecting the signatures in
|
||||||
// order of the inputs.
|
// order of the inputs.
|
||||||
pendingReservation.ourFundingSigs = make([][]byte, 0, len(ourContribution.Inputs))
|
pendingReservation.ourFundingSigs = make([][]byte, 0, len(ourContribution.Inputs))
|
||||||
|
@ -778,8 +773,7 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
|
||||||
// Grab the hash of the current pre-image in our chain, this is needed
|
// Grab the hash of the current pre-image in our chain, this is needed
|
||||||
// for our commitment tx.
|
// for our commitment tx.
|
||||||
// TODO(roasbeef): grab partial state above to avoid long attr chain
|
// TODO(roasbeef): grab partial state above to avoid long attr chain
|
||||||
ourCurrentRevokeHash := pendingReservation.partialState.OurShaChain.CurrentRevocationHash()
|
ourCurrentRevokeHash := pendingReservation.ourContribution.RevocationHash
|
||||||
ourContribution.RevocationHash = ourCurrentRevokeHash
|
|
||||||
|
|
||||||
// Create the txIn to our commitment transaction. In the process, we
|
// Create the txIn to our commitment transaction. In the process, we
|
||||||
// need to locate the index of the multi-sig output on the funding tx
|
// need to locate the index of the multi-sig output on the funding tx
|
||||||
|
@ -795,6 +789,7 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
|
||||||
theirCommitKey := theirContribution.CommitKey
|
theirCommitKey := theirContribution.CommitKey
|
||||||
ourCommitTx, err := createCommitTx(fundingTxIn, ourCommitKey, theirCommitKey,
|
ourCommitTx, err := createCommitTx(fundingTxIn, ourCommitKey, theirCommitKey,
|
||||||
ourCurrentRevokeHash, theirContribution.CsvDelay, initialBalance)
|
ourCurrentRevokeHash, theirContribution.CsvDelay, initialBalance)
|
||||||
|
ourCurrentRevokeHash[:], theirContribution.CsvDelay,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
req.err <- err
|
req.err <- err
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue