1
1
import { getPaymentFailureStatus , getPaymentOrNotSent } from '@/api/lnd'
2
- import { walletLogger } from '@/api/resolvers/wallet'
3
- import { formatSats , msatsToSats , toPositiveBigInt } from '@/lib/format'
2
+ import { msatsToSats , toPositiveBigInt } from '@/lib/format'
4
3
import { datePivot } from '@/lib/time'
5
4
import { notifyWithdrawal } from '@/lib/webPush'
6
5
import { Prisma } from '@prisma/client'
@@ -122,18 +121,11 @@ export async function payingActionConfirmed ({ data: args, models, lnd, boss })
122
121
123
122
if ( transitionedWithdrawal ) {
124
123
await notifyWithdrawal ( transitionedWithdrawal )
125
-
126
- const logger = walletLogger ( { models, wallet : transitionedWithdrawal . wallet } )
127
- logger ?. ok ( `↙ payment received: ${ formatSats ( msatsToSats ( transitionedWithdrawal . msatsPaid ) ) } ` , {
128
- // TODO: test this
129
- invoiceId : transitionedWithdrawal . invoiceForward . invoice . id
130
- } )
131
124
}
132
125
}
133
126
134
127
export async function payingActionFailed ( { data : args , models, lnd, boss } ) {
135
- let message
136
- const transitionedWithdrawal = await transitionWithdrawal ( 'payingActionFailed' , {
128
+ await transitionWithdrawal ( 'payingActionFailed' , {
137
129
toStatus : 'UNKNOWN_FAILURE' ,
138
130
...args ,
139
131
transition : async ( { dbWithdrawal, lndWithdrawal, tx } ) => {
@@ -151,21 +143,12 @@ export async function payingActionFailed ({ data: args, models, lnd, boss }) {
151
143
console . log ( `user refunded ${ msatsToSats ( dbWithdrawal . msatsFeePaying + dbWithdrawal . msatsPaying ) } sats` )
152
144
153
145
// update to particular status
154
- const { status, message : failureMessage } = getPaymentFailureStatus ( lndWithdrawal )
155
- message = failureMessage
146
+ const { status } = getPaymentFailureStatus ( lndWithdrawal )
156
147
157
148
console . log ( 'withdrawal failed with status' , status )
158
149
return {
159
150
status
160
151
}
161
152
}
162
153
} , { models, lnd, boss } )
163
-
164
- if ( transitionedWithdrawal ) {
165
- const logger = walletLogger ( { models, wallet : transitionedWithdrawal . wallet } )
166
- logger ?. error ( `incoming payment failed: ${ message } ` , {
167
- // TODO: test this
168
- invoiceId : transitionedWithdrawal . invoiceForward . invoice . id
169
- } )
170
- }
171
154
}
0 commit comments