lnwallet: add FundingFlag parameter to InitChannelReservation
This commit is contained in:
parent
10b838e9b4
commit
fffe15f0fd
@ -137,7 +137,8 @@ type ChannelReservation struct {
|
|||||||
// lnwallet.InitChannelReservation interface.
|
// lnwallet.InitChannelReservation interface.
|
||||||
func NewChannelReservation(capacity, fundingAmt, commitFeePerKw btcutil.Amount,
|
func NewChannelReservation(capacity, fundingAmt, commitFeePerKw btcutil.Amount,
|
||||||
wallet *LightningWallet, id uint64, pushMSat lnwire.MilliSatoshi,
|
wallet *LightningWallet, id uint64, pushMSat lnwire.MilliSatoshi,
|
||||||
chainHash *chainhash.Hash) (*ChannelReservation, error) {
|
chainHash *chainhash.Hash,
|
||||||
|
flags lnwire.FundingFlag) (*ChannelReservation, error) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ourBalance lnwire.MilliSatoshi
|
ourBalance lnwire.MilliSatoshi
|
||||||
@ -219,11 +220,12 @@ func NewChannelReservation(capacity, fundingAmt, commitFeePerKw btcutil.Amount,
|
|||||||
ChannelConfig: &channeldb.ChannelConfig{},
|
ChannelConfig: &channeldb.ChannelConfig{},
|
||||||
},
|
},
|
||||||
partialState: &channeldb.OpenChannel{
|
partialState: &channeldb.OpenChannel{
|
||||||
ChanType: chanType,
|
ChanType: chanType,
|
||||||
ChainHash: *chainHash,
|
ChainHash: *chainHash,
|
||||||
IsPending: true,
|
IsPending: true,
|
||||||
IsInitiator: initiator,
|
IsInitiator: initiator,
|
||||||
Capacity: capacity,
|
ChannelFlags: flags,
|
||||||
|
Capacity: capacity,
|
||||||
LocalCommitment: channeldb.ChannelCommitment{
|
LocalCommitment: channeldb.ChannelCommitment{
|
||||||
LocalBalance: ourBalance,
|
LocalBalance: ourBalance,
|
||||||
RemoteBalance: theirBalance,
|
RemoteBalance: theirBalance,
|
||||||
|
@ -108,6 +108,10 @@ type initFundingReserveMsg struct {
|
|||||||
// the responder as part of the initial channel creation.
|
// the responder as part of the initial channel creation.
|
||||||
pushMSat lnwire.MilliSatoshi
|
pushMSat lnwire.MilliSatoshi
|
||||||
|
|
||||||
|
// flags are the channel flags specified by the initiator in the
|
||||||
|
// open_channel message.
|
||||||
|
flags lnwire.FundingFlag
|
||||||
|
|
||||||
// err is a channel in which all errors will be sent across. Will be
|
// err is a channel in which all errors will be sent across. Will be
|
||||||
// nil if this initial set is successful.
|
// nil if this initial set is successful.
|
||||||
//
|
//
|
||||||
@ -449,7 +453,7 @@ func (l *LightningWallet) InitChannelReservation(
|
|||||||
capacity, ourFundAmt btcutil.Amount, pushMSat lnwire.MilliSatoshi,
|
capacity, ourFundAmt btcutil.Amount, pushMSat lnwire.MilliSatoshi,
|
||||||
commitFeePerKw, fundingFeePerWeight btcutil.Amount,
|
commitFeePerKw, fundingFeePerWeight btcutil.Amount,
|
||||||
theirID *btcec.PublicKey, theirAddr *net.TCPAddr,
|
theirID *btcec.PublicKey, theirAddr *net.TCPAddr,
|
||||||
chainHash *chainhash.Hash) (*ChannelReservation, error) {
|
chainHash *chainhash.Hash, flags lnwire.FundingFlag) (*ChannelReservation, error) {
|
||||||
|
|
||||||
errChan := make(chan error, 1)
|
errChan := make(chan error, 1)
|
||||||
respChan := make(chan *ChannelReservation, 1)
|
respChan := make(chan *ChannelReservation, 1)
|
||||||
@ -463,6 +467,7 @@ func (l *LightningWallet) InitChannelReservation(
|
|||||||
commitFeePerKw: commitFeePerKw,
|
commitFeePerKw: commitFeePerKw,
|
||||||
fundingFeePerWeight: fundingFeePerWeight,
|
fundingFeePerWeight: fundingFeePerWeight,
|
||||||
pushMSat: pushMSat,
|
pushMSat: pushMSat,
|
||||||
|
flags: flags,
|
||||||
err: errChan,
|
err: errChan,
|
||||||
resp: respChan,
|
resp: respChan,
|
||||||
}
|
}
|
||||||
@ -493,7 +498,8 @@ func (l *LightningWallet) handleFundingReserveRequest(req *initFundingReserveMsg
|
|||||||
|
|
||||||
id := atomic.AddUint64(&l.nextFundingID, 1)
|
id := atomic.AddUint64(&l.nextFundingID, 1)
|
||||||
reservation, err := NewChannelReservation(req.capacity, req.fundingAmount,
|
reservation, err := NewChannelReservation(req.capacity, req.fundingAmount,
|
||||||
req.commitFeePerKw, l, id, req.pushMSat, l.Cfg.NetParams.GenesisHash)
|
req.commitFeePerKw, l, id, req.pushMSat,
|
||||||
|
l.Cfg.NetParams.GenesisHash, req.flags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
req.err <- err
|
req.err <- err
|
||||||
req.resp <- nil
|
req.resp <- nil
|
||||||
|
Loading…
Reference in New Issue
Block a user