Commit Graph

103 Commits (38e86a1b0f28dc645a21d3016415da9cd619de3a)

Author SHA1 Message Date
Boris Nagaev d6aa4fe8a9
loopdb: all BaseDB's methods use receiver name db 3 months ago
Boris Nagaev 4c2d874b8d
loopdb: use passed transaction in ExecTx calls
Some calls used external queries instead of the passed one,
bypassing the transaction.
3 months ago
Boris Nagaev 1947b90842
multi: typed callback in ExecTx
Provide a wrapped store type, exposing ExecTx method with a subset
interface in the callback argument. BaseDB interfaces in instantout,
reservation and sweepbatcher use ExecTx with their subset Querier
instead of whole sqlc.Querier (*sqlc.Queries).

This is needed to make the packages more reusable, so they don't
depend on methods of *sqlc.Queries they don't use.
3 months ago
Boris Nagaev d341448568
loopdb: fix description of BaseDB.ExecTx 3 months ago
Boris Nagaev 3fd3fab8d1
loopdb: provide function NewSqlWriteOpts
It returns transaction options resulting in full (read+write) tx.

Use it in loopdb and instantout stores.
3 months ago
jinjingroad 12bc3b2e9e chore: fix some comments
Signed-off-by: jinjingroad <jinjingroad@sina.com>
4 months ago
András Bánki-Horváth 55241ffe04
Merge pull request #764 from bhandras/costs-cleanup-migration
loop: add migration to fix stored loop out costs
4 months ago
Andras Banki-Horvath f40ef193e9
loop: add migration for loopout swaps to fix negative stored costs
Previously we may have stored negative costs for some loop out swaps
which this commit attempts to correct by fetching all completed swap,
calculating the correct costs and overriding them in the database.
4 months ago
Andras Banki-Horvath c650cdc8a8
loopdb: add ability to track manual migrations 4 months ago
Andras Banki-Horvath 4f5c806ba5
loopdb: add helper methods to update swap costs
This commit adds the necessary sqlc code and SwapStore function to
update swap costs for all swaps in one transaction.
4 months ago
Boris Nagaev 7a7ea05e52
sweepbatcher/Store: do not provide LoopOut field
This data is not used by Batcher since commit
"sweepbatcher: load swap from loopdb, not own store".

Now sweepbatcher.Store depends only on tables sweeps and sweep_batches
and does not depend on swaps, loopout_swaps and htlc_keys, making it
easier to reuse.
4 months ago
Boris Nagaev c5862898a8
sqlc: remove trailing spaces in queries 4 months ago
Andras Banki-Horvath 939c9b4ccf
loopdb+sweepbatcher: add the DropBatch call 4 months ago
Andras Banki-Horvath 4749c029bb
loopdb: add migraton and DB code to handle payment timeout 4 months ago
Boris Nagaev e30cb5f2a8
multi: apply make fmt 5 months ago
Andras Banki-Horvath fb0c7f504e
loopdb: bump sqlc to 1.25.0 6 months ago
András Bánki-Horváth 65b8cb6036
Merge pull request #694 from bhandras/cost-cleanup
loop: fix the loopout per sweep onchain cost and cleanup server cost calculation (both loopin and loopout)
7 months ago
Andras Banki-Horvath 7fe4ee2f3b
loopdb: make sqlite sync for extra durability 7 months ago
Andras Banki-Horvath b4ebb19a77
loopdb+sweepbatcher: add GetParentBatch and TotalSwept calls 7 months ago
Slyghtning 755d5dc68e
loopd: new loopin state for incorrect amount sweeps 7 months ago
sputn1ck ee0309f942
instantout: add instantout store 8 months ago
George Tsagkarelis e0d85958f7
multi: move StoreMock to loopdb 8 months ago
George Tsagkarelis 99608ad515
loopdb+sweepbatcher: add sweepbatcher store 8 months ago
sputn1ck a29f7e4a6b
loopdb: add reservation sqlc code 8 months ago
Konstantin Nick 9f2bf5ca07
Merge pull request #682 from sputn1ck/fix_faulty_timestamps
Fix faulty timestamps
9 months ago
sputn1ck d36c154151
loopdb: fix unit test 9 months ago
sputn1ck 57fa22b095
loopdb: remove unused code 9 months ago
elbandi d6be549e17
loopdb: Fix PublicationDeadline
This commit fixes the publication deadline based on the swaps invoice
timestamp.
9 months ago
bitcoin-lightning aefabfaeed
fix typo in store.go 9 months ago
bitcoin-lightning 864d4e5cdd
fix typo in sqlite.go 9 months ago
Slyghtning 0bd4b7cf89
loopdb: state insufficient confirmed funds 10 months ago
Slyghtning 0fbf253391
loopdb: abandon swap state 10 months ago
sputn1ck b8ada0416c
loopdb: fix leapyear parsing 11 months ago
Oliver Gugger 08026dab93
multi: update linter, fix issues 12 months ago
sputn1ck 942b0dc1bb
loopdb: change faulty year migration logic
This commit changes how the faulty year migration works, by just
checking if the deadline is far in the future and then
fixing it.
1 year ago
kon 64bdef9238
sqldb: change time parsing function
This commit changes the time parsing function to use the time.Parse
function instead of the prior manual parsing. Only if the year is
far in the future, we replace it with the current year.
1 year ago
sputn1ck 5cafa34ae9
loopdb: fix timestamp parsing 1 year ago
sputn1ck be9ca71bf2
loopd: convert unix millisecond timestamps to seconds 1 year ago
sputn1ck f25b5e9626
loopdb: fix faulty timestamps on startup
This commit fixes faulty timestamps caused by using unix milliseconds
as unix seconds on startup.
This commit also adds a test for the lightning-terminal issue that first
reported the bug.
1 year ago
sputn1ck 69b4df0d9b
loopdb: add migrator
This commit adds a migrator to the loopdb package that manages migrating
between 2 databases
1 year ago
sputn1ck 3ee5bb6365
loopdb: add postgres store
This commit adds a postgres store to the loopdb package.
Ths postgres migrator uses a replacer filesystem to replace the
sqlite types to postgres types in the migration.
1 year ago
sputn1ck ab8923fc38
loopdb: add sqlite test files 1 year ago
sputn1ck 9278c18768
loopdb: add nil check to boltdb liquidity test
This commit adds a nil check to the boltdb liquidity test. There was
a difference between the sqlite and boltdb implementation. This test
covers that.
1 year ago
sputn1ck 0826b748f5
loopdb: add sqlite store implementation 1 year ago
sputn1ck f8c65bbc4c
loopdb: create base sqlite store 1 year ago
sputn1ck 206e463db7
loopdb: generate sqlc files 1 year ago
sputn1ck 85a757f635
loopdb: implement sqlite queries 1 year ago
sputn1ck 3c58e98a0f
loopdb: add loopdb sqlite migrations 1 year ago
sputn1ck 5d9d7c5c6e
loopdb: add batch insert
This commit adds a batch insert to the interface. This greatly reduces
the time the migration will take. It is not implemented for the boltdb, as
we will not be supporting migrating to the boltdb.
1 year ago
sputn1ck becc8a38d8
multi: use context in loopdb call
This commit adds a context to our loopdb interface, which we should use
in the sqlite migration.
1 year ago