gigawallet icon indicating copy to clipboard operation
gigawallet copied to clipboard

Set expired dates to invoices

Open qlpqlp opened this issue 1 year ago • 2 comments

If in a heavily environment we have 1M > unpaid invoices, GigaWallet will always try to check them all, making things slower

I propose to set an expired date (calculating the Block time in future) per invoice, creating a new field on the invoice table called expired that stores the Dogecoin n Block in the future equivalent to the expire date in the future

futureTime := time.Date(2023, time.September, 13, 0, 0, 0, 0, time.UTC) // invoice expire date/time timeDifference := futureTime.Sub(time.Now()) // current local time blocksGenerated := int(timeDifference.Minutes()) * 1 // currently its one Dogecoin Block per minute to calculate how many blocks are generated until the expire date futureBlockNumber := currentDogecoinBlockNumber + blocksGenerated // we get the future Block Number by calculating

If the n Blocks have passed, on GigaWallet on the invoice table we add a true flag for example on a new field called archive and so GigaWallet will not check any invoice with the flag archive = true

Add an option to "manually" check an archived invoice if wanted, in case some client notifies that made a payment after the expiration date.

qlpqlp avatar Sep 10 '23 13:09 qlpqlp