lnwallet: update reservation workflow to revoke keys

With this commit, the reservation workflow for the single funder use
case is now aware of the usage of revocation keys.

The changes are relatively minor:
  * contributions now have RevocationKeys instead of RevocationHashes
  * CompleteReservationSingle now takes the initiators revocation key
This commit is contained in:
Olaoluwa Osuntokun 2016-06-30 12:02:45 -07:00
parent 6dcefac868
commit 78346c81e7
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -16,35 +16,37 @@ import (
// funding transactions, and finally a signature for the other party's version // funding transactions, and finally a signature for the other party's version
// of the commitment transaction. // of the commitment transaction.
type ChannelContribution struct { type ChannelContribution struct {
// Amount of funds contributed to the funding transaction. // FundingOutpoint is the amount of funds contributed to the funding
// transaction.
FundingAmount btcutil.Amount FundingAmount btcutil.Amount
// Inputs to the funding transaction. // Inputs to the funding transaction.
Inputs []*wire.TxIn Inputs []*wire.TxIn
// Outputs to be used in the case that the total value of the fund // ChangeOutputs are the Outputs to be used in the case that the total
// ing inputs is greater than the total potential channel capacity. // value of the fund ing inputs is greater than the total potential
// channel capacity.
ChangeOutputs []*wire.TxOut ChangeOutputs []*wire.TxOut
// The key to be used for the funding transaction's P2SH multi-sig // MultiSigKey is the the key to be used for the funding transaction's
// 2-of-2 output. // P2SH multi-sig 2-of-2 output.
// TODO(roasbeef): replace with CDP
MultiSigKey *btcec.PublicKey MultiSigKey *btcec.PublicKey
// The key to be used for this party's version of the commitment // CommitKey is the key to be used for this party's version of the
// transaction. // commitment transaction.
// TODO(roasbeef): replace with CDP
CommitKey *btcec.PublicKey CommitKey *btcec.PublicKey
// Address to be used for delivery of cleared channel funds in the scenario // DeliveryAddress is the address to be used for delivery of cleared
// of a cooperative channel closure. // channel funds in the scenario of a cooperative channel closure.
DeliveryAddress btcutil.Address DeliveryAddress btcutil.Address
// Hash to be used as the revocation for the initial version of this // RevocationKey is the key to be used in the revocation clause for the
// party's commitment transaction. // initial version of this party's commitment transaction.
RevocationHash [32]byte RevocationKey *btcec.PublicKey
// The delay (in blocks) to be used for the pay-to-self output in this // CsvDelay The delay (in blocks) to be used for the pay-to-self output
// party's version of the commitment transaction. // in this party's version of the commitment transaction.
CsvDelay uint32 CsvDelay uint32
} }
@ -274,12 +276,13 @@ func (r *ChannelReservation) CompleteReservation(fundingInputScripts []*InputScr
// the .OurSignatures() method. As this method should only be called as a // the .OurSignatures() method. As this method should only be called as a
// response to a single funder channel, only a commitment signature will be // response to a single funder channel, only a commitment signature will be
// populated. // populated.
func (r *ChannelReservation) CompleteReservationSingle(fundingPoint *wire.OutPoint, func (r *ChannelReservation) CompleteReservationSingle(revocationKey *btcec.PublicKey,
commitSig []byte) error { fundingPoint *wire.OutPoint, commitSig []byte) error {
errChan := make(chan error, 1) errChan := make(chan error, 1)
r.wallet.msgChan <- &addSingleFunderSigsMsg{ r.wallet.msgChan <- &addSingleFunderSigsMsg{
pendingFundingID: r.reservationID, pendingFundingID: r.reservationID,
revokeKey: revocationKey,
fundingOutpoint: fundingPoint, fundingOutpoint: fundingPoint,
theirCommitmentSig: commitSig, theirCommitmentSig: commitSig,
err: errChan, err: errChan,