server: update OpenChannel to properly pass in custom funding fee
This commit is contained in:
parent
afaa1681c8
commit
3c4a6f42fa
23
server.go
23
server.go
@ -1551,8 +1551,8 @@ func (s *server) DisconnectPeer(pubKey *btcec.PublicKey) error {
|
|||||||
//
|
//
|
||||||
// NOTE: This function is safe for concurrent access.
|
// NOTE: This function is safe for concurrent access.
|
||||||
func (s *server) OpenChannel(peerID int32, nodeKey *btcec.PublicKey,
|
func (s *server) OpenChannel(peerID int32, nodeKey *btcec.PublicKey,
|
||||||
localAmt btcutil.Amount,
|
localAmt btcutil.Amount, pushAmt lnwire.MilliSatoshi,
|
||||||
pushAmt lnwire.MilliSatoshi) (chan *lnrpc.OpenStatusUpdate, chan error) {
|
fundingFeePerByte btcutil.Amount) (chan *lnrpc.OpenStatusUpdate, chan error) {
|
||||||
|
|
||||||
updateChan := make(chan *lnrpc.OpenStatusUpdate, 1)
|
updateChan := make(chan *lnrpc.OpenStatusUpdate, 1)
|
||||||
errChan := make(chan error, 1)
|
errChan := make(chan error, 1)
|
||||||
@ -1585,18 +1585,23 @@ func (s *server) OpenChannel(peerID int32, nodeKey *btcec.PublicKey,
|
|||||||
return updateChan, errChan
|
return updateChan, errChan
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We'll scale the sat/byte set as the fee rate to sat/weight as this
|
||||||
|
// is what's used internally when deciding upon coin selection.
|
||||||
|
fundingFeePerWeight := fundingFeePerByte / blockchain.WitnessScaleFactor
|
||||||
|
|
||||||
// Spawn a goroutine to send the funding workflow request to the
|
// Spawn a goroutine to send the funding workflow request to the
|
||||||
// funding manager. This allows the server to continue handling queries
|
// funding manager. This allows the server to continue handling queries
|
||||||
// instead of blocking on this request which is exported as a
|
// instead of blocking on this request which is exported as a
|
||||||
// synchronous request to the outside world.
|
// synchronous request to the outside world.
|
||||||
req := &openChanReq{
|
req := &openChanReq{
|
||||||
targetPeerID: peerID,
|
targetPeerID: peerID,
|
||||||
targetPubkey: nodeKey,
|
targetPubkey: nodeKey,
|
||||||
chainHash: *activeNetParams.GenesisHash,
|
chainHash: *activeNetParams.GenesisHash,
|
||||||
localFundingAmt: localAmt,
|
localFundingAmt: localAmt,
|
||||||
pushAmt: pushAmt,
|
fundingFeePerWeight: fundingFeePerWeight,
|
||||||
updates: updateChan,
|
pushAmt: pushAmt,
|
||||||
err: errChan,
|
updates: updateChan,
|
||||||
|
err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(roasbeef): pass in chan that's closed if/when funding succeeds
|
// TODO(roasbeef): pass in chan that's closed if/when funding succeeds
|
||||||
|
Loading…
Reference in New Issue
Block a user