@@ -27,6 +27,7 @@ import (
2727	"github.com/lightninglabs/taproot-assets/tapfreighter" 
2828	"github.com/lightninglabs/taproot-assets/taprpc" 
2929	"github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc" 
30+ 	"github.com/lightninglabs/taproot-assets/taprpc/authmailboxrpc" 
3031	"github.com/lightninglabs/taproot-assets/taprpc/mintrpc" 
3132	"github.com/lightninglabs/taproot-assets/taprpc/rfqrpc" 
3233	tchrpc "github.com/lightninglabs/taproot-assets/taprpc/tapchannelrpc" 
@@ -76,25 +77,32 @@ type itestNode struct {
7677// multiRfqNodes contains all the itest nodes that are required to set up the 
7778// multi RFQ network topology. 
7879type  multiRfqNodes  struct  {
79- 	charlie , dave , erin , fabia , yara  itestNode 
80- 	universeTap                       * tapClient 
80+ 	charlie , dave , erin , fabia , yara ,  george  itestNode 
81+ 	universeTap                                * tapClient 
8182}
8283
8384// createTestMultiRFQAssetNetwork creates a lightning network topology which 
8485// consists of both bitcoin and asset channels. It focuses on the property of 
8586// having multiple channels available on both the sender and receiver side. 
87+ // The George node is using a way different oracle that provides asset rates 
88+ // that fall outside of the configured tolerance bounds, leading to RFQ 
89+ // negotiation failures. 
8690// 
8791// The topology we are going for looks like the following: 
8892// 
89- //	  /---[sats]--> Erin --[assets]--\ 
90- //	 /                                \ 
91- //	/                                  \ 
93+ //	   /---[sats]--> Erin --[assets]--\ 
94+ //	  /                                \ 
95+ //	 /                                  \ 
96+ //	/                                    \ 
9297// 
93- // Charlie  -----[sats]-->   Dave   --[assets]----> Fabia 
98+ // Charlie  -----[sats]--> Dave --[assets]-->  Fabia 
9499// 
95- //	\                                  / 
96- //	 \                                / 
97- //	  \---[sats]--> Yara --[assets]--/ 
100+ //	\                                     / / 
101+ //	 \                                   / / 
102+ //	  \---[sats]--> Yara --[assets]-----/ / 
103+ //	   \                                 / 
104+ //	    \                               / 
105+ //	     \--[sats]-> George --[assets]-/ 
98106func  createTestMultiRFQAssetNetwork (t  * harnessTest , net  * NetworkHarness ,
99107	nodes  multiRfqNodes , mintedAsset  * taprpc.Asset , assetSendAmount ,
100108	fundingAmount  uint64 , pushSat  int64 ) (* lnrpc.ChannelPoint ,
@@ -105,6 +113,7 @@ func createTestMultiRFQAssetNetwork(t *harnessTest, net *NetworkHarness,
105113	erin , erinTap  :=  nodes .erin .Lnd , nodes .erin .Tapd 
106114	_ , fabiaTap  :=  nodes .fabia .Lnd , nodes .fabia .Tapd 
107115	yara , yaraTap  :=  nodes .yara .Lnd , nodes .yara .Tapd 
116+ 	george , georgeTap  :=  nodes .george .Lnd , nodes .george .Tapd 
108117	universeTap  :=  nodes .universeTap 
109118
110119	// Let's open the normal sats channels between Charlie and the routing 
@@ -130,6 +139,13 @@ func createTestMultiRFQAssetNetwork(t *harnessTest, net *NetworkHarness,
130139		},
131140	)
132141
142+ 	_  =  openChannelAndAssert (
143+ 		t , net , charlie , george , lntest.OpenChannelParams {
144+ 			Amt :         10_000_000 ,
145+ 			SatPerVByte : 5 ,
146+ 		},
147+ 	)
148+ 
133149	ctxb  :=  context .Background ()
134150	assetID  :=  mintedAsset .AssetGenesis .AssetId 
135151	var  groupKey  []byte 
@@ -224,6 +240,34 @@ func createTestMultiRFQAssetNetwork(t *harnessTest, net *NetworkHarness,
224240	)
225241	itest .AssertNonInteractiveRecvComplete (t .t , yaraTap , 1 )
226242
243+ 	// We need to send some assets to George, so he can fund an asset 
244+ 	// channel with Fabia. 
245+ 	georgeAddr , err  :=  georgeTap .NewAddr (ctxb , & taprpc.NewAddrRequest {
246+ 		Amt :     assetSendAmount ,
247+ 		AssetId : assetID ,
248+ 		ProofCourierAddr : fmt .Sprintf (
249+ 			"%s://%s" , proof .UniverseRpcCourierType ,
250+ 			charlieTap .node .Cfg .LitAddr (),
251+ 		),
252+ 	})
253+ 	require .NoError (t .t , err )
254+ 
255+ 	t .Logf ("Sending %v asset units to George..." , assetSendAmount )
256+ 
257+ 	// Send the assets to George. 
258+ 	itest .AssertAddrCreated (t .t , georgeTap , mintedAsset , georgeAddr )
259+ 	sendResp , err  =  charlieTap .SendAsset (ctxb , & taprpc.SendAssetRequest {
260+ 		TapAddrs : []string {georgeAddr .Encoded },
261+ 	})
262+ 	require .NoError (t .t , err )
263+ 	itest .ConfirmAndAssertOutboundTransfer (
264+ 		t .t , t .lndHarness .Miner .Client , charlieTap , sendResp , assetID ,
265+ 		[]uint64 {
266+ 			mintedAsset .Amount  -  4 * assetSendAmount , assetSendAmount ,
267+ 		}, 3 , 4 ,
268+ 	)
269+ 	itest .AssertNonInteractiveRecvComplete (t .t , georgeTap , 1 )
270+ 
227271	// We fund the Dave->Fabia channel. 
228272	fundRespDF , err  :=  daveTap .FundChannel (
229273		ctxb , & tchrpc.FundChannelRequest {
@@ -263,6 +307,19 @@ func createTestMultiRFQAssetNetwork(t *harnessTest, net *NetworkHarness,
263307	require .NoError (t .t , err )
264308	t .Logf ("Funded channel between Yara and Fabia: %v" , fundRespYF )
265309
310+ 	// We fund the George->Fabia channel. 
311+ 	fundRespGF , err  :=  georgeTap .FundChannel (
312+ 		ctxb , & tchrpc.FundChannelRequest {
313+ 			AssetAmount :        fundingAmount ,
314+ 			AssetId :            assetID ,
315+ 			PeerPubkey :         fabiaTap .node .PubKey [:],
316+ 			FeeRateSatPerVbyte : 5 ,
317+ 			PushSat :            pushSat ,
318+ 		},
319+ 	)
320+ 	require .NoError (t .t , err )
321+ 	t .Logf ("Funded channel between George and Fabia: %v" , fundRespGF )
322+ 
266323	// Make sure the pending channel shows up in the list and has the 
267324	// custom records set as JSON. 
268325	assertPendingChannels (
@@ -274,17 +331,21 @@ func createTestMultiRFQAssetNetwork(t *harnessTest, net *NetworkHarness,
274331	assertPendingChannels (
275332		t .t , yaraTap .node , mintedAsset , 1 , fundingAmount , 0 ,
276333	)
334+ 	assertPendingChannels (
335+ 		t .t , georgeTap .node , mintedAsset , 1 , fundingAmount , 0 ,
336+ 	)
277337
278338	// Now that we've looked at the pending channels, let's actually confirm 
279339	// all three of them. 
280- 	mineBlocks (t , net , 6 , 3 )
340+ 	mineBlocks (t , net , 6 , 4 )
281341
282342	// We'll be tracking the expected asset balances throughout the test, so 
283343	// we can assert it after each action. 
284- 	charlieAssetBalance  :=  mintedAsset .Amount  -  3 * assetSendAmount 
344+ 	charlieAssetBalance  :=  mintedAsset .Amount  -  4 * assetSendAmount 
285345	daveAssetBalance  :=  assetSendAmount  -  fundingAmount 
286346	erinAssetBalance  :=  assetSendAmount  -  fundingAmount 
287347	yaraAssetBalance  :=  assetSendAmount  -  fundingAmount 
348+ 	georgeAssetBalance  :=  assetSendAmount  -  fundingAmount 
288349
289350	itest .AssertBalances (
290351		t .t , charlieTap , charlieAssetBalance ,
@@ -303,6 +364,10 @@ func createTestMultiRFQAssetNetwork(t *harnessTest, net *NetworkHarness,
303364		t .t , yaraTap , yaraAssetBalance , itest .WithAssetID (assetID ),
304365	)
305366
367+ 	itest .AssertBalances (
368+ 		t .t , georgeTap , georgeAssetBalance , itest .WithAssetID (assetID ),
369+ 	)
370+ 
306371	// Assert that the proofs for both channels has been uploaded to the 
307372	// designated Universe server. 
308373	assertUniverseProofExists (
@@ -317,6 +382,10 @@ func createTestMultiRFQAssetNetwork(t *harnessTest, net *NetworkHarness,
317382		t .t , universeTap , assetID , groupKey , fundingScriptTreeBytes ,
318383		fmt .Sprintf ("%v:%v" , fundRespYF .Txid , fundRespYF .OutputIndex ),
319384	)
385+ 	assertUniverseProofExists (
386+ 		t .t , universeTap , assetID , groupKey , fundingScriptTreeBytes ,
387+ 		fmt .Sprintf ("%v:%v" , fundRespGF .Txid , fundRespGF .OutputIndex ),
388+ 	)
320389
321390	return  nil , nil , nil 
322391}
@@ -2549,6 +2618,7 @@ type tapClient struct {
25492618	rfqrpc.RfqClient 
25502619	tchrpc.TaprootAssetChannelsClient 
25512620	universerpc.UniverseClient 
2621+ 	authmailboxrpc.MailboxClient 
25522622}
25532623
25542624func  newTapClient (t  * testing.T , node  * HarnessNode ) * tapClient  {
0 commit comments