-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autoswap: Amount Backoff #68
Labels
enhancement
New feature or request
Comments
jackstar12
added a commit
that referenced
this issue
Mar 14, 2024
* feat: initial swap recommendations * feat: swap recommendation command * feat: `ChanId` in db and grpc * experiment with wallet seed phrases * feat: create swaps inside channel watcher channel watcher was moved to rpc server to avoid cyclic imports * feat: `Pair` type in boltz * feat: liquid reverse swaps (#3) * test liquid deposit * feat: `BlindingKey` in db and grpc * initial liquid experimenting * liquid testing * fix findVout * add real claim tx in test * feat: `Transaction` abstraction * feat: `Network` abstraction * cleanup test * deps * feat: use `Transaction` * refactor: rename Size to VSize on Transaction * fix cgo issues * start implementing liquid tx building * chore: fix dependency issue * implement psetv2 for liquid * fix lockup address for liquid * fix signature in liquid tx construction * refactor: more consistent naming, cleanup * refactor: require instead of assert in tests * cleanup remove old tests and unnecessary submodule * cleanup * refactor: simplify address config * feat: autoswap through `LocalBalanceThreshhold` * feat: `SwapType` constants in boltz * feat: pair parameter for service info * refactor: remove `Pair` from config * refactor: exclude in-use channels before recommendations this helps avoid a situation where a strategy operating on the total channel balance picks a channel which is in-use * feat: `Percentage` util * feat: min local reserve, fee checks * chore: add tools installation command in makefile * feat: auto swap integration tests * feat: use fresh db in test * feat: channel specific swaps currently reverse only * refactor: move core autoswap functionality into module * feat: regtest in workflow * fix: channel balance denomination in sat instead of msat * uncomment mempool test for now * feat: `CheckInvoicePaid` function for lightning interface reduce reliance on lnd - only chain listener is left now * fix: add test config to repo * fix: use `RetryFor` instead of `Maxdelay` * fix: check all returned invoices in `CheckInvoicePaid` * fix: handle error handling in lnd * Update boltz/network.go Co-authored-by: michael1011 <[email protected]> * refactor: rename `NewBtcTx` * Update boltzrpc/boltzrpc.proto Co-authored-by: michael1011 <[email protected]> * feat: budget config values * feat: add `createdAt` and fee fields to db * feat: error handling and claim tx fee from reverse nursery * feat: QueryFees function * feat: initial `Budget` implementation * refactor: use `rawRecommendation` internally to distinguish between checked and unchecked * feat: `IsAuto` param in fee calculation * feat: initial failure backoff * feat: reasons for channel exclusion * fix: get btc asset id from network object * refactor: rename `BlindingKey` to `OurOutputBlindingKey` * cleanup * refactor: use `QueryRow` in fee query * comment * refactor: rename `Dismissed` to `DismissedReason` * refactor: use last budget end date as current start date and potentially move forward * fix: coalesce in fee query so it doesnt disappear when no rows are present * refactor: cleanup migrations * refactor: make `DismissedReasons` an array * feat: abstract onchain (#13) * initial onchain interfaces * feat: swap type check in imbalance strategy * feat: swap init logs * minor test improvements * feat: abstract mempool and add mempool liquid support * refactor: still use mempool for btc and liquid due to lacking cln support * refactor: move address checking logic into autoswap package * remove dead file * feat: cln block listener through polling * test: refund normal swaps * fix: add different transaction output types back * feat: lightning node configuration * fix: minimum fee * refactor: make strategy config more explicit * feat: fee fallback to wallet * refactor: use struct for parsing json in mempool * feat: minimum fee in estimations * fix: error if lightning cant connect at all * feat: cln polling interval depending on network * chore: cleanup * refactor: remove pair param from swaprecommendations rpc * update protos * cleanup * fix: merging errors * add missing onchain to server * fix: correct expiry in cln invoice creation * feat: autostatus command * feat: more default values for autoswap config * feat: format dates properly * feat: test autostats * refactor: make stats sql more readable * feat: total balance strategy with % threshhold * refactor: dont provide a specific channel in local balance strat * refactor: make autobduget uint64 in grpc * refactor: return pointer to swaptype * doc: proper description for new commands * feat: correctly store onchain and service fees for all swaps (#17) * feat: onchain transaction fee provider * feat: save normal swap fees to database * fix: production endpoint in mempool test * fix: check script length of liquid outputs when finding fee * feat: cache input transaction in btc tx fee calculation * feat: add reverse swap fees to grpc and check them in tests * feat: accurate representation of boltz service fee * cleanup * refactor: only store normal swap lockup fees if paid by internal wallet other payments might come from exchanges that batch a lot of transactions together which would mess with our fee * refactor: remove unnecessary network call * feat: make sure onchain amount of normal swap is always stored * refactor: make fee fields optional in grpc * fix: merging errors * fix: regtest (#19) * fix: disable lnd channel specific payments for now * change regtest branch for now * test: run get info on cln instead of lnd (lnd causes issues?) * update workflow * fix permissions * ci: only push on master * refactor: remove unnecessary install step * refactor: move onchain test to mempool to avoid import cycle * fix old test * refactor: rename all boltz-lnd occurences to boltz-client * make tests more robust * skip per channel autoswap tests * bump go version * fix: mempool fee test * fix: adjust minfee for btc * fix: linting issues * fix: checkout code before installing go * refactor: improve logging (#29) * feat: new logger * refactor: rename `logger.Warning` to `logger.Warn` * chore: improve logging messages * refactor: log level in config, remove logprefix * fix: use new logger in tests aswell * refactor: return no error in logger init * refactor: move test logger to test pkg * feat: grpc swap info streaming (#30) * feat: swapinfo streaming rpc * fix: make behaviour of `PayInvoice` identical across lnd and cln * fix: make sure the swap listener isnt closed too early * feat: intial streaming integraion in cli * fix: wrong log placement in `PayReverseSwap` * feat: channelforwarder * fix: use new logger * test: pay deposits via cli and use mempool api directly * fix: explicitly close stop handler * feat: log status of swap updates * doc: add `ArgsUsage` to swapinfo commands * doc: adjust `GetSwapInfoStream` comment * feat: detect outdated macaroons * fix: remove unnecessary buffers and properly close receiver channels * fix: `SetSwapLockupTransactionId` sql parameters * feat: initial gdk experimentation * feat: mnemonic import / backup * feat: liquid wallet cli commands * feat: cleanup and test liquid wallet * fix: use correct payment script in liquid transactions * refactor: make chain used in transaction explicit * feat: group liquid commands together * fix: linting errors and cleanup * refactor: unify channel ids (#31) * refactor: unify channel ids and make naming more consistent * revert unwanted changes * fix: weird indentation * test: more cases for channel id * refactor: log message in cln * refactor: better naming for `ChannelId` proto * refactor: log both formats in chanId `String` function * fix: allow parsing of empty string as zero-channel id * test: poll balance on init for more reliability * feat: liquid wallet grpc * feat: include gdk details in eror message * refactor: parse gdk results into proper structs for better safety * feat: estimate fee * refactor: properly free all GA_json objects * feat: allow wallet creation through grpc * fix: add missing macaroon permissions * refactor: make sure free calls dont collide * refactor: remove balance log on startup * feat: support unconfidential addresses in reverse swaps * refactor: dont return wallet info on import rpc * feat: allow specifying subaccount to use * doc: add comments to new rpc commands * cleanup * fix: eof for .gitignore * feat: forbid p2pk claim addresses (#35) * refactor: remove unnecessary secp lib * fix: use correct subaccount in liquid `NewAddress` * feat: normal liquid swaps (#36) * feat: liquid swaps * refactor: use createswap for deposit internally * fix: minor fee issues and better tests * fix: endpoint hell * chore: improved error handling * lint * Update nursery/reverse.go Co-authored-by: michael1011 <[email protected]> --------- Co-authored-by: michael1011 <[email protected]> * fix: dont send raw pairId to boltz * fix: make sure right node is chosen * refactor: better naming for autoswap config values * test: dont use memory db seems to cause some weird errors * feat: static liquid linking (#37) * fix: use correct subaccount in liquid `NewAddress` * feat: static liquid linking * cleanup * use cross plattform builder * refactor: remove --parallel 1 in favor of build arg * feat: prettify cli (#38) * feat: prettify listswaps * refactor: timestamps in grpc and prettify in cli * feat: highlight swap status * feat: prettify autostatus command * feat: allow yes/no to be y/n * feat: prettify liquid commands * fix: wait until liquid subaccounts are synced before fetching balances * feat: loading spinner * fix: proper errors * feat: use survey lib for prompts * cleanup * feat: prettify swap stream and use it for deposit and withdraw * refactor: take client instead of ctx as an argument in commands that are reused * fix: stop ticker in subaccount sync * fix: default to btc when parsing pairId * chore: deprecate old fields * fix: add newline on end of swap stream * fix: use actual fee estimate when paying normal swap internally * docs: clarify config (#41) * refactor: remove channel creation internally (#39) * refactor: remove channel creation * fix: connect to current lightning node instead of lnd * feat: set mempool endpoint based on network (#49) * fix: correct network check for setting boltz endpoint (#51) * feat: unconfirmed liquid balances (#46) * refactor: use native segwit accounts by default * feat: return unconfirmed balance and type in subaccount grpc * feat: parse liquid account type in cli * fix: wrong error message * refactor: add `Balance` message to `LiquidSubaccount` proto * fix: correct account types * feat: detect which node to use based on config (#57) * refactor: move autoswap execution logic into AutoSwapper struct (#64) * cleanup * fix: ping mempool ws to avoid disconnect (#60) * chore: better error messages for block listener * fix: ping mempool websocket regulary to avoid disconnect * fix: set node param in test AutoSwap test * feat: show help commands when required args are missing (#56) * feat: show help commands when required args are missing * refactor: use decorator * fix: no silly logs in test and better sqlite dsn * refactor: rename datadir to .boltz and support old .boltz-lnd aswell (#61) * fix: tests (#67) * feat: cli improvements (#65) * refactor: merge deposit and createswap commands * refactor: merge withdraw and createreverserswap commands * refactor: rename `Manual` category to `Swaps` * refactor: improve command descriptions * chore: update cli package * feat: cli example usage * feat: no-zero-conf flag on withdraw * feat: shell completions setup command * log * fix: error if trying to autosend with 0 amount eof * refactor: remove aliases * fix: newline * feat: properly parse pair in createswap rpc to allow using L-BTC as a pair * feat: --any-amount flag for createswap * feat: --liquid flag * fix: handle error * feat: global description * feat: liquid block listener (#71) * feat: implement `BlockListener` for liquid wallet through gdk notifications * feat: implement `GetBlockHeight` for `Wallet` interface * feat: `GetBlockHeight` for mempool * feat: make sure liquid wallet isnt used if not logged in * feat: add `Notification` enum * fix: check if lnd / cln are connected in `Ready` function * fix: only fetch lockup tx fee once its confirmed (#68) * fix: retry getting tx fee made by wallet * fix: make sure lock up tx is set on recovery aswell * feat: return custom Error if boltz returns error message in api * fix: ignore boltz api error when querying lockup transaction * fix: error message * feat: allow external refund address for normal swaps (#69) * feat: allow external refund address for normal swaps * refactor: make `RefundAddress` optional in grpc * fix: correct refunaddress comparison * feat: stop command (#70) * feat: stop command * feat: nursery shutdown * feat: add timeout to http shutdown * feat: include `auto_send` in grpc * test: refactor swap fee checking * feat: allow sending unconfirmed transactions in liquid wallet * fix: dont autosend in recovery test * fix: only close swapListener once * fix: lint * refactor: combine external and internal refund tests * feat: proper autoswap cli (#66) * feat: show whether autoswapper is running in cli * feat: autoswap rpc and cli * feat: show strategy name in status * feat: account for edge case where local balance threshhold is too low * feat: restart swapper when liquid wallet has been changed * feat: store and show errors happening on autoswapper startup * fix: correct swap type on absolute balance strategy with relative threshhold * refactor: remove autoswap daemon cli parameters * feat: only add dismissed reason once * refactor: threshhold -> threshold * improve command description Co-authored-by: Kilian <[email protected]> * refactor: autoswap status * feat: do not crash on startup if configuration is invalid * feat: show config before enabling autoswap * feat: allow excluding dismissed recommendations * doc: basic autoswap description in cli * refactor: rename * fix: proper permissions for autoswap * chore: cleanup boltzrpc * chore: cleanup boltz rpc * feat: autoswap macaroon entity * cleanup * refactor: make `no_dismissed` field optional * fix(liquid): only remove mnemonic backup file instead of entire directory seems to cause issues with gdk --------- Co-authored-by: Kilian <[email protected]> * fix(test): poll swap state on startup instead of trying to stream * refactor: remove unnecessary `done` chan from swap streams --------- Co-authored-by: michael1011 <[email protected]> Co-authored-by: Kilian <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of direct retry logic in a for loop, we could check if the last swap made through a specific channel was a failure. If this is the case we limit the maximum to e.g. 50% of the amount we failed with previously. This would have a similar effect to just retrying in a loop and reducing amount everytime and would not loose its "state" upon restarting the autoswapper
Related: #67
The text was updated successfully, but these errors were encountered: