Commit Graph

235 Commits

Author SHA1 Message Date
Michael Bumann
c8de57c876 Update README.md 2022-01-23 00:55:26 +02:00
Michael Bumann
c2edd1302d Update notes.md 2022-01-23 00:40:03 +02:00
Michael Bumann
9435f75d1f Merge pull request #66 from getAlby/db/better-pg-constraints
Trying to get the PG constraints working
2022-01-23 00:23:07 +02:00
Michael Bumann
436baeeccb Merge pull request #64 from getAlby/invoice-update-subscriptions
First draft to subscribe for LND invoice update
2022-01-23 00:22:46 +02:00
Michael Bumann
35e7da2f30 Search for correct state 2022-01-22 22:57:14 +01:00
Michael Bumann
af8c72d2c9 Store invoice expiry and use search for not expired invoices in the invoice subscription
When subscribing for invoice updates we only subscribe to not expired invoices.
We assume expired invoices will never get paid.
2022-01-22 21:11:19 +01:00
Michael Bumann
0de0ed18b4 Missing fix 2022-01-22 15:19:30 +01:00
Michael Bumann
0de314abbc Fix typo 2022-01-22 14:33:23 +01:00
Michael Bumann
0021dc0a2e Update README.md 2022-01-22 15:22:41 +02:00
Michael Bumann
20e94714a5 Merge pull request #48 from getAlby/populate-readme
WIP: Populate Readme
2022-01-22 14:38:33 +02:00
Michael Bumann
d90a695172 Context how do they work... 2022-01-22 13:32:15 +01:00
Michael Bumann
a4e597ccfc Comments 2022-01-22 13:30:13 +01:00
Michael Bumann
b54f04701f Start invoice subscription from the last unsettled invoice
We want to get updates starting from those invoices.
This allows us to catch up in case the app was offline while some invoices got settled
2022-01-22 13:24:51 +01:00
Michael Bumann
319524ea4c Trying to get the PG constraints working
This uses row level locking on the accounts. If two transactions access the same account one fails
2022-01-22 13:00:46 +01:00
Michael Bumann
c75e703d80 Try reconnecting on invoice subscription errors 2022-01-22 12:57:00 +01:00
Michael Bumann
1c8d8a99b5 Merge pull request #65 from getAlby/fix/db-locked-err
use bun.Tx to avoid db locked err
2022-01-22 11:42:29 +02:00
kiwiidb
366f66a2e2 use bun.Tx to avoid db locked err 2022-01-22 10:33:54 +01:00
Michael Bumann
71eabae443 Split up process invoice updates 2022-01-21 21:29:16 +01:00
Michael Bumann
12dbb48c8d First draft to subscribe for LND invoice update 2022-01-21 20:57:41 +01:00
Michael Bumann
613a485d7e Merge pull request #54 from getAlby/payinvoice
Payinvoice
2022-01-21 21:56:12 +02:00
Michael Bumann
3e088a7652 Pass invoice description hash string to LND 2022-01-21 17:40:52 +01:00
Viktor Patchev
f02c20a2a6 Update readme 2022-01-21 17:18:37 +01:00
Michael Bumann
2606403489 Use tx to call do the db updates 2022-01-21 15:12:08 +01:00
Michael Bumann
43aba70dd8 Fix invoice preimages for internal payments
We create the preimage on incoming invoices. If it is an internal incoming payment (meaning from one user to another user) we use that preimage and save it on the outgoing invoice.
This makes sure we can give wallets the correct preimage for a payment request even though no lightning transaction happened
2022-01-21 13:56:02 +01:00
Michael Bumann
89acf29b24 cleanup 2022-01-21 12:25:19 +01:00
Michael Bumann
f683a22a66 Correct gettxs and getuserinvoices responses 2022-01-21 12:22:49 +01:00
Michael Bumann
228edcbe39 Return user invoices
and maybe correctly encode the Buffers?
2022-01-21 11:49:08 +01:00
Michael Bumann
55fbaeea92 nullzero entry for the parent txn 2022-01-21 11:17:19 +01:00
Michael Bumann
a5d1c3f4ed Add constraint to invoices DB to make sure settled invoices have a preimage saved
We just try to store as much potential relevant information as possible.
This could help debugging and verifiying payments if there is an issue
2022-01-21 11:16:48 +01:00
Michael Bumann
2097807c85 Support Amount values as string/integer in request JSON 2022-01-21 11:15:35 +01:00
Michael Bumann
289d7405f1 Rollback only in the SendPayment call
this one handles the transactions which is passed to the SendPaymentSync and SendInternalPayment call
2022-01-20 19:00:49 +01:00
Michael Bumann
9ed269dedf Split up functions for internal vs. external payments 2022-01-20 18:31:03 +01:00
Michael Bumann
7d955a1d7b Support self-payments
If the destination of the invoice is our node we only create internal transaction entries and do not call the underlaying lightning node
2022-01-20 16:50:26 +01:00
Michael Bumann
90a686677f Save invoice destination
And save the node pubkey in the service to make it usable
2022-01-20 15:41:50 +01:00
kiwiidb
ef169f7857 fix main branch name in workflow 2022-01-20 15:19:32 +01:00
kiwiidb
955a181a54 use newer dockerfile 2022-01-20 15:17:35 +01:00
Michael Bumann
72e9c9f1fd Merge pull request #59 from getAlby/feature/ci
Feature/ci
2022-01-20 15:46:04 +02:00
Michael Bumann
7d6dc15b8c Merge branch 'main' into payinvoice
* main:
  Correct style
  Add blank routes required for bluewallet
2022-01-20 14:28:26 +01:00
Michael Bumann
9e78d9001e Merge pull request #58 from getAlby/blank-routes
Add blank routes required for bluewallet
2022-01-20 15:28:04 +02:00
Michael Bumann
1d17708875 Correct style 2022-01-20 14:20:15 +01:00
kiwiidb
f2158de902 add dockerfile and workflow 0.0.1 2022-01-20 14:20:01 +01:00
Michael Bumann
3a67f86a34 Merge main 2022-01-20 14:15:40 +01:00
Michael Bumann
31570b8adf Add blank routes required for bluewallet 2022-01-20 14:02:32 +01:00
Michael Bumann
6822b274e5 Add check payment endpoint 2022-01-20 13:58:46 +01:00
Michael Bumann
c06a749b8d Merge pull request #51 from getAlby/no-panic
Panic less
2022-01-20 14:52:31 +02:00
Michael Bumann
1719fe65c4 Merge pull request #57 from getAlby/fix/remove-interface-pointer
Fix/remove-interface-pointer
2022-01-20 14:52:14 +02:00
kiwiidb
7c51383feb replace all panics with log.Fatal 2022-01-20 13:44:59 +01:00
kiwiidb
d3466aa0cc remove pointer to interface 2022-01-20 13:24:59 +01:00
Michael Bumann
70a7e1a8eb Add DB constraints to check for user balances 2022-01-20 02:03:51 +01:00
Michael Bumann
d4183c100b Add payinvoice endpoint 2022-01-20 01:57:31 +01:00