channedb/mp_payment: add Hash to individual HTLCs

For AMP payments the hash used for each HTLC will differ, and we will
need to retrive it after a restart. We therefore persist it with each
attempt.
This commit is contained in:
Johan T. Halseth
2021-03-30 14:53:29 +02:00
parent 41ae3530a3
commit 06f045fca3
4 changed files with 45 additions and 2 deletions

View File

@@ -57,8 +57,10 @@ func makeFakeInfo() (*PaymentCreationInfo, *HTLCAttemptInfo) {
var preimg lntypes.Preimage
copy(preimg[:], rev[:])
hash := preimg.Hash()
c := &PaymentCreationInfo{
PaymentHash: preimg.Hash(),
PaymentHash: hash,
Value: 1000,
// Use single second precision to avoid false positive test
// failures due to the monotonic time component.
@@ -71,6 +73,7 @@ func makeFakeInfo() (*PaymentCreationInfo, *HTLCAttemptInfo) {
SessionKey: priv,
Route: testRoute,
AttemptTime: time.Unix(100, 0),
Hash: &hash,
}
return c, a
}