lnwallet: AddFunds is now AddContribution, accounts for commitment tx

* Contribution from remote host necessary to construct the initial
commitment transaction is now also expected
* All message structs and handlers updated accordingly
* AddContribution now also generates both commitment tnxs, and
generates a signature for their version of the commitment transaction
This commit is contained in:
Olaoluwa Osuntokun committed 2015-12-21 15:53:34 -06:00
1 parent e7e546af9a
commit 584fc9b620
2 files changed
+81 -17

No files matched your search

+12 -5
View File
@@ -249,16 +249,23 @@ func (r *ChannelReservation) OurKeys() (*btcec.PrivateKey, *btcec.PrivateKey) {
return r.partialState.multiSigKey, r.partialState.ourCommitKey
}
// AddFunds...
// TODO(roasbeef): add commitment txns, etc.
func (r *ChannelReservation) AddFunds(theirInputs []*wire.TxIn, theirChangeOutputs []*wire.TxOut, multiSigKey *btcec.PublicKey) error {
// AddContribution...
func (r *ChannelReservation) AddContribution(theirInputs []*wire.TxIn,
theirChangeOutputs []*wire.TxOut, commitKey, multiSigKey *btcec.PublicKey,
deliveryAddress btcutil.Address, initialRevocation [wire.HashSize]byte,
acceptedDelayPeriod int64) error {
errChan := make(chan error, 1)
r.wallet.msgChan <- &addCounterPartyFundsMsg{
r.wallet.msgChan <- &addContributionMsg{
pendingFundingID: r.reservationID,
theirInputs: theirInputs,
theirChangeOutputs: theirChangeOutputs,
theirKey: multiSigKey,
theirMultiSigKey: multiSigKey,
theirCommitKey: commitKey,
deliveryAddress: deliveryAddress,
revocationHash: initialRevocation,
csvDelay: acceptedDelayPeriod,
err: errChan,
}