lnwire: replace ChannelPoint with ChannelID, use new PendingChanID

This commit is contained in:
Olaoluwa Osuntokun committed 2017-04-16 15:22:27 -07:00
1 parent 8147151fbf
commit c06894a2e6
27 files changed
+151 -223

No files matched your search

+6 -14
View File
@@ -4,7 +4,6 @@ import (
"fmt"
"github.com/roasbeef/btcd/btcec"
"github.com/roasbeef/btcd/wire"
"github.com/roasbeef/btcutil"
"io"
@@ -21,8 +20,8 @@ import (
// both sides are able to arrive at an identical closure transaction as they
// know the order of the inputs/outputs.
type CloseRequest struct {
// ChannelPoint serves to identify which channel is to be closed.
ChannelPoint wire.OutPoint
// ChanID serves to identify which channel is to be closed.
ChanID ChannelID
// RequesterCloseSig is the signature of the requester for the fully
// assembled closing transaction.
@@ -36,10 +35,10 @@ type CloseRequest struct {
}
// NewCloseRequest creates a new CloseRequest.
func NewCloseRequest(cp wire.OutPoint, sig *btcec.Signature) *CloseRequest {
func NewCloseRequest(cid ChannelID, sig *btcec.Signature) *CloseRequest {
// TODO(roasbeef): update once fees aren't hardcoded
return &CloseRequest{
ChannelPoint: cp,
ChanID: cid,
RequesterCloseSig: sig,
}
}
@@ -53,12 +52,8 @@ var _ Message = (*CloseRequest)(nil)
//
// This is part of the lnwire.Message interface.
func (c *CloseRequest) Decode(r io.Reader, pver uint32) error {
// ChannelPoint (8)
// RequesterCloseSig (73)
// First byte length then sig
// Fee (8)
return readElements(r,
&c.ChannelPoint,
&c.ChanID,
&c.RequesterCloseSig,
&c.Fee)
}
@@ -68,11 +63,8 @@ func (c *CloseRequest) Decode(r io.Reader, pver uint32) error {
//
// This is part of the lnwire.Message interface.
func (c *CloseRequest) Encode(w io.Writer, pver uint32) error {
// ChannelID
// RequesterCloseSig
// Fee
return writeElements(w,
c.ChannelPoint,
c.ChanID,
c.RequesterCloseSig,
c.Fee)
}