routing+refactor: let BlindedEdge carry BlindedPayment

This commit is purely a refactor. In it, we let the `BlindedEdge` struct
carry a pointer to the `BlindedPayment` that it was derived from. This
is done now because later on in the PR series, we will need more
information about the `BlindedPayment` that an edge was derived from.

Since we now pass in the whole BlindedPayment, we swap out the
`cipherText` member for a `hopIndex` member so that we dont carry around
two sources of truth in the same struct.
This commit is contained in:
Elle Mouton committed 2024-07-10 09:12:39 +02:00
1 parent a9655357ca
commit f7a9aa875e
6 files changed
+109 -60

No files matched your search

+15 -7
View File
@@ -42,9 +42,13 @@ func TestIntermediatePayloadSize(t *testing.T) {
hop: route.Hop{
EncryptedData: []byte{12, 13},
},
edge: &BlindedEdge{
cipherText: []byte{12, 13},
},
edge: &BlindedEdge{blindedPayment: &BlindedPayment{
BlindedPath: &sphinx.BlindedPath{
BlindedHops: []*sphinx.BlindedHopInfo{
{CipherText: []byte{12, 13}},
},
},
}},
},
{
name: "Blinded edge - introduction point",
@@ -52,10 +56,14 @@ func TestIntermediatePayloadSize(t *testing.T) {
EncryptedData: []byte{12, 13},
BlindingPoint: blindedPoint,
},
edge: &BlindedEdge{
cipherText: []byte{12, 13},
blindingPoint: blindedPoint,
},
edge: &BlindedEdge{blindedPayment: &BlindedPayment{
BlindedPath: &sphinx.BlindedPath{
BlindingPoint: blindedPoint,
BlindedHops: []*sphinx.BlindedHopInfo{
{CipherText: []byte{12, 13}},
},
},
}},
},
}