address amt validation
This commit is contained in:
parent
f8fe946b40
commit
2c8d57dd6e
2 changed files with 7 additions and 1 deletions
|
|
@ -595,9 +595,15 @@ export default class {
|
|||
|
||||
async PayInternalAddress(ctx: Types.UserContext, req: Types.PayAddressRequest): Promise<Types.PayAddressResponse> {
|
||||
this.log("paying internal address")
|
||||
let amount = req.amountSats
|
||||
if (req.swap_operation_id) {
|
||||
const swap = await this.storage.paymentStorage.GetTransactionSwap(req.swap_operation_id, ctx.app_user_id)
|
||||
amount = amount > 0 ? amount : swap?.invoice_amount || 0
|
||||
await this.storage.paymentStorage.DeleteTransactionSwap(req.swap_operation_id)
|
||||
}
|
||||
if (amount <= 0) {
|
||||
throw new Error("invalid tx amount")
|
||||
}
|
||||
const { blockHeight } = await this.lnd.GetInfo()
|
||||
const app = await this.storage.applicationStorage.GetApplication(ctx.app_id)
|
||||
const isManagedUser = ctx.user_id !== app.owner.user_id
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ export default (mainHandler: Main): Types.ServerMethods => {
|
|||
PayAddress: async ({ ctx, req }) => {
|
||||
const err = Types.PayAddressRequestValidate(req, {
|
||||
address_CustomCheck: addr => addr !== '',
|
||||
amountSats_CustomCheck: amt => amt > 0,
|
||||
// amountSats_CustomCheck: amt => amt > 0,
|
||||
// satsPerVByte_CustomCheck: spb => spb > 0
|
||||
})
|
||||
if (err != null) throw new Error(err.message)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue