Skip to content

Commit

Permalink
Update upload.ts
Browse files Browse the repository at this point in the history
Silly math calc not needed
  • Loading branch information
sirdeggen authored Feb 27, 2025
1 parent 3adf1a5 commit 9c2d40b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions back/src/functions/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ export default async function (req: Request, res: Response) {
const fileHash = Utils.toHex(Hash.sha256(Utils.toArray(file.toString('hex'), 'hex')))
console.log({ fileHash })

// Calculate and allocate required tokens
const fees = Math.ceil(Math.max(1, (length - 200)) / 1000)
console.log({ fees })
// For a 32 byte hash fees will always be 1
const fees = 1
const utxo = await db.collection('utxos').findOneAndUpdate({ fileHash: null, confirmed: true }, { $set: { fileHash } })

console.log({ utxo })
Expand Down Expand Up @@ -129,4 +128,4 @@ export default async function (req: Request, res: Response) {
console.error('Failed to upload file', error)
res.status(500).json({ error: error.message })
}
}
}

0 comments on commit 9c2d40b

Please sign in to comment.