Skip to content

Commit

Permalink
lntest: add coverage for single hop blinded route query routes
Browse files Browse the repository at this point in the history
  • Loading branch information
carlaKC committed Jan 31, 2023
1 parent 6aef946 commit 03bb9bf
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions lntest/itest/lnd_route_blinding.go
Original file line number Diff line number Diff line change
@@ -286,6 +286,45 @@ func testQueryBlindedRoutes(ht *lntemp.HarnessTest) {
require.NotNil(ht, htlcAttempt.Failure)
require.Equal(ht, uint32(2), htlcAttempt.Failure.FailureSourceIndex)

// Next, we test an edge case where just an introduction node is
// included as a "single hop blinded route".
introNodeBlinded := &lnrpc.BlindedPayment{
Route: &lnrpc.BlindedRoute{
IntroductionNode: carol.PubKey[:],
BlindingPoint: blindingBytes,
BlindedHops: []*lnrpc.BlindedHop{
{
// The first hop in the blinded route is
// expected to be the introduction node.
BlindedNode: carolBlindedBytes,
EncryptedData: encryptedDataCarol,
},
},
},

RelayParameters: &lnrpc.BlindedRelay{
AggregateBaseFeeMsat: 0,
TotalCltvDelta: 0,
},
RelayConstraints: &lnrpc.BlindedConstraints{
CltvLimit: cltvLimit,
},
}
req = &lnrpc.QueryRoutesRequest{
AmtMsat: paymentAmt,
BlindedPath: introNodeBlinded,
FinalCltvDelta: int32(finalDelta),
}

ctxt, cancel = context.WithTimeout(ctxb, defaultTimeout)
resp, err = alice.RPC.LN.QueryRoutes(ctxt, req)
cancel()
require.NoError(ht, err)

// Assert that we have one route, and two hops: Alice/Bob and Bob/Carol.
require.Len(ht, resp.Routes, 1)
require.Len(ht, resp.Routes[0].Hops, 2)

ht.CloseChannel(alice, chanPointAliceBob)
ht.CloseChannel(bob, chanPointBobCarol)
}

0 comments on commit 03bb9bf

Please sign in to comment.