multi: unexport session key and add constructor for htlc attempt info

This commit is contained in:
carla committed 2021-05-19 09:03:46 +02:00
1 parent 6c330d3121
commit eb068bf666
7 files changed
+35 -24

No files matched your search

+3 -5
View File
@@ -331,11 +331,9 @@ func genInfo() (*channeldb.PaymentCreationInfo, *channeldb.HTLCAttemptInfo,
CreationTime: time.Unix(time.Now().Unix(), 0),
PaymentRequest: []byte("hola"),
},
&channeldb.HTLCAttemptInfo{
AttemptID: 1,
SessionKey: priv,
Route: testRoute,
}, preimage, nil
channeldb.NewHtlcAttemptInfo(
1, priv, testRoute, time.Time{}, nil,
), preimage, nil
}
func genPreimage() ([32]byte, error) {
+6 -10
View File
@@ -499,7 +499,7 @@ func (p *shardHandler) collectResult(attempt *channeldb.HTLCAttemptInfo) (
// Regenerate the circuit for this attempt.
_, circuit, err := generateSphinxPacket(
&attempt.Route, hash[:], attempt.SessionKey,
&attempt.Route, hash[:], attempt.SessionKey(),
)
if err != nil {
return nil, err
@@ -677,15 +677,11 @@ func (p *shardHandler) createNewPaymentAttempt(rt *route.Route, lastShard bool)
rt.Hops[0].ChannelID,
)
// We now have all the information needed to populate
// the current attempt information.
attempt := &channeldb.HTLCAttemptInfo{
AttemptID: attemptID,
AttemptTime: p.router.cfg.Clock.Now(),
SessionKey: sessionKey,
Route: *rt,
Hash: &hash,
}
// We now have all the information needed to populate the current
// attempt information.
attempt := channeldb.NewHtlcAttemptInfo(
attemptID, sessionKey, *rt, p.router.cfg.Clock.Now(), &hash,
)
return firstHop, htlcAdd, attempt, nil
}