lnd: export Manager's InitFundingWorkflow method
This commit is contained in:
1 parent
1b84d07c4d
commit
105e961b20
3 files changed
+19
-19
No files matched your search
+2
-2
@@ -2916,10 +2916,10 @@ func (f *Manager) announceChannel(localIDKey, remoteIDKey, localFundingKey,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// initFundingWorkflow sends a message to the funding manager instructing it
|
// InitFundingWorkflow sends a message to the funding manager instructing it
|
||||||
// to initiate a single funder workflow with the source peer.
|
// to initiate a single funder workflow with the source peer.
|
||||||
// TODO(roasbeef): re-visit blocking nature..
|
// TODO(roasbeef): re-visit blocking nature..
|
||||||
func (f *Manager) initFundingWorkflow(peer lnpeer.Peer, req *openChanReq) {
|
func (f *Manager) InitFundingWorkflow(peer lnpeer.Peer, req *openChanReq) {
|
||||||
f.fundingRequests <- &initFundingMsg{
|
f.fundingRequests <- &initFundingMsg{
|
||||||
peer: peer,
|
peer: peer,
|
||||||
openChanReq: req,
|
openChanReq: req,
|
||||||
|
|||||||
+16
-16
@@ -669,7 +669,7 @@ func fundChannel(t *testing.T, alice, bob *testNode, localFundingAmt,
|
|||||||
err: errChan,
|
err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
|
|
||||||
// Alice should have sent the OpenChannel message to Bob.
|
// Alice should have sent the OpenChannel message to Bob.
|
||||||
var aliceMsg lnwire.Message
|
var aliceMsg lnwire.Message
|
||||||
@@ -1327,7 +1327,7 @@ func testLocalCSVLimit(t *testing.T, aliceMaxCSV, bobRequiredCSV uint16) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Alice should have sent the OpenChannel message to Bob.
|
// Alice should have sent the OpenChannel message to Bob.
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
var aliceMsg lnwire.Message
|
var aliceMsg lnwire.Message
|
||||||
select {
|
select {
|
||||||
case aliceMsg = <-alice.msgChan:
|
case aliceMsg = <-alice.msgChan:
|
||||||
@@ -1391,7 +1391,7 @@ func testLocalCSVLimit(t *testing.T, aliceMaxCSV, bobRequiredCSV uint16) {
|
|||||||
err: errChan,
|
err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
bob.fundingMgr.initFundingWorkflow(alice, initReq)
|
bob.fundingMgr.InitFundingWorkflow(alice, initReq)
|
||||||
|
|
||||||
// Bob should have sent the OpenChannel message to Alice.
|
// Bob should have sent the OpenChannel message to Alice.
|
||||||
var bobMsg lnwire.Message
|
var bobMsg lnwire.Message
|
||||||
@@ -1744,7 +1744,7 @@ func TestFundingManagerPeerTimeoutAfterInitFunding(t *testing.T) {
|
|||||||
err: errChan,
|
err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
|
|
||||||
// Alice should have sent the OpenChannel message to Bob.
|
// Alice should have sent the OpenChannel message to Bob.
|
||||||
var aliceMsg lnwire.Message
|
var aliceMsg lnwire.Message
|
||||||
@@ -1806,7 +1806,7 @@ func TestFundingManagerPeerTimeoutAfterFundingOpen(t *testing.T) {
|
|||||||
err: errChan,
|
err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
|
|
||||||
// Alice should have sent the OpenChannel message to Bob.
|
// Alice should have sent the OpenChannel message to Bob.
|
||||||
var aliceMsg lnwire.Message
|
var aliceMsg lnwire.Message
|
||||||
@@ -1877,7 +1877,7 @@ func TestFundingManagerPeerTimeoutAfterFundingAccept(t *testing.T) {
|
|||||||
err: errChan,
|
err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
|
|
||||||
// Alice should have sent the OpenChannel message to Bob.
|
// Alice should have sent the OpenChannel message to Bob.
|
||||||
var aliceMsg lnwire.Message
|
var aliceMsg lnwire.Message
|
||||||
@@ -2604,7 +2604,7 @@ func TestFundingManagerCustomChannelParameters(t *testing.T) {
|
|||||||
err: errChan,
|
err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
|
|
||||||
// Alice should have sent the OpenChannel message to Bob.
|
// Alice should have sent the OpenChannel message to Bob.
|
||||||
var aliceMsg lnwire.Message
|
var aliceMsg lnwire.Message
|
||||||
@@ -2892,7 +2892,7 @@ func TestFundingManagerMaxPendingChannels(t *testing.T) {
|
|||||||
var accepts []*lnwire.AcceptChannel
|
var accepts []*lnwire.AcceptChannel
|
||||||
var lastOpen *lnwire.OpenChannel
|
var lastOpen *lnwire.OpenChannel
|
||||||
for i, initReq := range initReqs {
|
for i, initReq := range initReqs {
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
|
|
||||||
// Alice should have sent the OpenChannel message to Bob.
|
// Alice should have sent the OpenChannel message to Bob.
|
||||||
var aliceMsg lnwire.Message
|
var aliceMsg lnwire.Message
|
||||||
@@ -3056,7 +3056,7 @@ func TestFundingManagerRejectPush(t *testing.T) {
|
|||||||
err: errChan,
|
err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
|
|
||||||
// Alice should have sent the OpenChannel message to Bob.
|
// Alice should have sent the OpenChannel message to Bob.
|
||||||
var aliceMsg lnwire.Message
|
var aliceMsg lnwire.Message
|
||||||
@@ -3113,7 +3113,7 @@ func TestFundingManagerMaxConfs(t *testing.T) {
|
|||||||
err: errChan,
|
err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
|
|
||||||
// Alice should have sent the OpenChannel message to Bob.
|
// Alice should have sent the OpenChannel message to Bob.
|
||||||
var aliceMsg lnwire.Message
|
var aliceMsg lnwire.Message
|
||||||
@@ -3397,7 +3397,7 @@ func TestMaxChannelSizeConfig(t *testing.T) {
|
|||||||
|
|
||||||
// After processing the funding open message, bob should respond with
|
// After processing the funding open message, bob should respond with
|
||||||
// an error rejecting the channel that exceeds size limit.
|
// an error rejecting the channel that exceeds size limit.
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
openChanMsg := expectOpenChannelMsg(t, alice.msgChan)
|
openChanMsg := expectOpenChannelMsg(t, alice.msgChan)
|
||||||
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
||||||
assertErrorSent(t, bob.msgChan)
|
assertErrorSent(t, bob.msgChan)
|
||||||
@@ -3412,7 +3412,7 @@ func TestMaxChannelSizeConfig(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// We expect Bob to respond with an Accept channel message.
|
// We expect Bob to respond with an Accept channel message.
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
openChanMsg = expectOpenChannelMsg(t, alice.msgChan)
|
openChanMsg = expectOpenChannelMsg(t, alice.msgChan)
|
||||||
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
||||||
assertFundingMsgSent(t, bob.msgChan, "AcceptChannel")
|
assertFundingMsgSent(t, bob.msgChan, "AcceptChannel")
|
||||||
@@ -3432,7 +3432,7 @@ func TestMaxChannelSizeConfig(t *testing.T) {
|
|||||||
|
|
||||||
// After processing the funding open message, bob should respond with
|
// After processing the funding open message, bob should respond with
|
||||||
// an error rejecting the channel that exceeds size limit.
|
// an error rejecting the channel that exceeds size limit.
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
openChanMsg = expectOpenChannelMsg(t, alice.msgChan)
|
openChanMsg = expectOpenChannelMsg(t, alice.msgChan)
|
||||||
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
||||||
assertErrorSent(t, bob.msgChan)
|
assertErrorSent(t, bob.msgChan)
|
||||||
@@ -3465,7 +3465,7 @@ func TestWumboChannelConfig(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We expect Bob to respond with an Accept channel message.
|
// We expect Bob to respond with an Accept channel message.
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
openChanMsg := expectOpenChannelMsg(t, alice.msgChan)
|
openChanMsg := expectOpenChannelMsg(t, alice.msgChan)
|
||||||
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
||||||
assertFundingMsgSent(t, bob.msgChan, "AcceptChannel")
|
assertFundingMsgSent(t, bob.msgChan, "AcceptChannel")
|
||||||
@@ -3476,7 +3476,7 @@ func TestWumboChannelConfig(t *testing.T) {
|
|||||||
|
|
||||||
// After processing the funding open message, bob should respond with
|
// After processing the funding open message, bob should respond with
|
||||||
// an error rejecting the channel.
|
// an error rejecting the channel.
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
openChanMsg = expectOpenChannelMsg(t, alice.msgChan)
|
openChanMsg = expectOpenChannelMsg(t, alice.msgChan)
|
||||||
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
||||||
assertErrorSent(t, bob.msgChan)
|
assertErrorSent(t, bob.msgChan)
|
||||||
@@ -3491,7 +3491,7 @@ func TestWumboChannelConfig(t *testing.T) {
|
|||||||
|
|
||||||
// We should now be able to initiate a wumbo channel funding w/o any
|
// We should now be able to initiate a wumbo channel funding w/o any
|
||||||
// issues.
|
// issues.
|
||||||
alice.fundingMgr.initFundingWorkflow(bob, initReq)
|
alice.fundingMgr.InitFundingWorkflow(bob, initReq)
|
||||||
openChanMsg = expectOpenChannelMsg(t, alice.msgChan)
|
openChanMsg = expectOpenChannelMsg(t, alice.msgChan)
|
||||||
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
bob.fundingMgr.ProcessFundingMsg(openChanMsg, alice)
|
||||||
assertFundingMsgSent(t, bob.msgChan, "AcceptChannel")
|
assertFundingMsgSent(t, bob.msgChan, "AcceptChannel")
|
||||||
|
|||||||
@@ -3734,7 +3734,7 @@ func (s *server) OpenChannel(
|
|||||||
// manager. This allows the server to continue handling queries instead
|
// manager. This allows the server to continue handling queries instead
|
||||||
// of blocking on this request which is exported as a synchronous
|
// of blocking on this request which is exported as a synchronous
|
||||||
// request to the outside world.
|
// request to the outside world.
|
||||||
go s.fundingMgr.initFundingWorkflow(peer, req)
|
go s.fundingMgr.InitFundingWorkflow(peer, req)
|
||||||
|
|
||||||
return req.updates, req.err
|
return req.updates, req.err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user