insert htlc used for channel open

This commit is contained in:
Jesse de Wit
2024-02-19 15:05:03 +01:00
parent 04f2ee06bf
commit 5fe08773f7
7 changed files with 87 additions and 2 deletions

View File

@@ -625,8 +625,22 @@ func (i *Interceptor) handlePaymentChanOpened(event *paymentChanOpenedEvent) {
resolution.part.resolution <- resolution.resolution
}
now := time.Now()
payment.registration.IsComplete = true
go i.store.SetCompleted(context.TODO(), payment.registration.Id)
go func() {
i.store.SetCompleted(context.TODO(), payment.registration.Id)
for _, resolution := range resolutions {
i.historyStore.AddOpenChannelHtlc(context.TODO(), &history.OpenChannelHtlc{
NodeId: i.config.NodeId,
PeerId: destination,
ChannelPoint: event.channelPoint,
OriginalAmountMsat: resolution.part.req.OutgoingAmountMsat,
ForwardAmountMsat: resolution.resolution.AmountMsat,
IncomingAmountMsat: resolution.part.req.IncomingAmountMsat,
ForwardTime: now,
})
}
}()
delete(i.inflightPayments, event.paymentId)
}