server: update OpenChannel to properly pass in custom funding fee

This commit is contained in:
Olaoluwa Osuntokun 2017-11-23 00:57:52 -06:00
parent afaa1681c8
commit 3c4a6f42fa
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -1551,8 +1551,8 @@ func (s *server) DisconnectPeer(pubKey *btcec.PublicKey) error {
//
// NOTE: This function is safe for concurrent access.
func (s *server) OpenChannel(peerID int32, nodeKey *btcec.PublicKey,
localAmt btcutil.Amount,
pushAmt lnwire.MilliSatoshi) (chan *lnrpc.OpenStatusUpdate, chan error) {
localAmt btcutil.Amount, pushAmt lnwire.MilliSatoshi,
fundingFeePerByte btcutil.Amount) (chan *lnrpc.OpenStatusUpdate, chan error) {
updateChan := make(chan *lnrpc.OpenStatusUpdate, 1)
errChan := make(chan error, 1)
@ -1585,6 +1585,10 @@ func (s *server) OpenChannel(peerID int32, nodeKey *btcec.PublicKey,
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
// funding manager. This allows the server to continue handling queries
// instead of blocking on this request which is exported as a
@ -1594,6 +1598,7 @@ func (s *server) OpenChannel(peerID int32, nodeKey *btcec.PublicKey,
targetPubkey: nodeKey,
chainHash: *activeNetParams.GenesisHash,
localFundingAmt: localAmt,
fundingFeePerWeight: fundingFeePerWeight,
pushAmt: pushAmt,
updates: updateChan,
err: errChan,