mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopd: wire static risk decision persistence
Create the static loop-in SQL store before the notification manager and pass a persistence callback so server confirmation-risk decisions are durably recorded before fanout.
This commit is contained in:
parent
e53bb67e73
commit
3e2b9452fe
1 changed files with 20 additions and 6 deletions
|
|
@ -555,10 +555,30 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
|
|||
}
|
||||
}
|
||||
|
||||
// Static address loop-in store setup is needed by the notification
|
||||
// manager so confirmation-risk decisions are durable before fan-out.
|
||||
staticAddressLoopInStore := loopin.NewSqlStore(
|
||||
loopdb.NewTypedStore[loopin.Querier](baseDb),
|
||||
clock.NewDefaultClock(), d.lnd.ChainParams,
|
||||
)
|
||||
|
||||
// Start the notification manager.
|
||||
notificationCfg := ¬ifications.Config{
|
||||
Client: loop_swaprpc.NewSwapServerClient(swapClient.Conn),
|
||||
CurrentToken: swapClient.L402Store.CurrentToken,
|
||||
PersistStaticLoopInRiskDecision: func(ctx context.Context,
|
||||
swapHash lntypes.Hash, accepted bool) error {
|
||||
|
||||
decision := loopin.ConfirmationRiskDecisionRejected
|
||||
if accepted {
|
||||
decision = loopin.ConfirmationRiskDecisionAccepted
|
||||
}
|
||||
|
||||
return staticAddressLoopInStore.
|
||||
RecordStaticAddressRiskDecision(
|
||||
ctx, swapHash, decision,
|
||||
)
|
||||
},
|
||||
}
|
||||
notificationManager := notifications.NewManager(notificationCfg)
|
||||
|
||||
|
|
@ -662,12 +682,6 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
|
|||
}
|
||||
openChannelManager = openchannel.NewManager(openChannelCfg)
|
||||
|
||||
// Static address loop-in manager setup.
|
||||
staticAddressLoopInStore := loopin.NewSqlStore(
|
||||
loopdb.NewTypedStore[loopin.Querier](baseDb),
|
||||
clock.NewDefaultClock(), d.lnd.ChainParams,
|
||||
)
|
||||
|
||||
// Run the deposit swap hash migration.
|
||||
err = loopin.MigrateDepositSwapHash(
|
||||
d.mainCtx, swapDb, depositStore, staticAddressLoopInStore,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue