Our preimage push test previously relied on our dropping down to the
default sweep conf target to mock a drop in chain fees. This makes
our test dependent on height, which makes changes to our sweep logic
regarding when we reveal our preimage break this test. In this commit
that logic is replaced with simply locking our mock and updating fees
on the fly.
We update to the latest lndclient that now requires a label when
publishing an on-chain transaction. Instead of just adding an empty
string, we use the proper labels added in a previous commit.
Add a dated fee budget to our swap suggestions. This budget only applies
to automatically dispatched swaps (which will be added in later
commits). We choose to apply the fee budget to our suggestions so that
they perfectly replicate what the autolooper would do. The budget has a
start date so that it can be refreshed once it has been used up over a
period (rather than having to endlessly increase it).
We need the newer version of lndclient to get our synced to chain
state. This requires changes to our test mock, so it is separated
into a different commit. Since lndclient is expanding to be used in
projects other than loop, the client interface is embedded in our
mock rather than implementing functions we do not need. Functions that
we already use in tests are updated accordingly.
Note that while this commit bumps us to a version of lndclient that
defaults to requiring lnd 0.11, we do not bump our required version
yet because we are not using any new endpoints.
To allow users to specify differing confirmation targets, we store the
swap conf target per-swap. This makes us restart safe, so we do not
forget confirmation values for swaps that are in flight when we restart.
Once we have revealed our preimage to the world with a sweep attempt,
we can safely push our preimage to the server to speed up on chain
claim.
Rather than rely on the server, we use the state of our invoice in lnd
to determine whether we should continue trying to push the preimage to
the server.
Projects that use a later version of lnd than loop, but also depend on
loop itself would run into the following build error:
github.com/lightninglabs/loop/lndclient
../../go/pkg/mod/github.com/lightninglabs/loop@v0.2.3-alpha/lndclient/walletkit_client.go:30:11: undefined: lnwallet.SatPerKWeight
../../go/pkg/mod/github.com/lightninglabs/loop@v0.2.3-alpha/lndclient/walletkit_client.go:32:54: undefined: lnwallet.SatPerKWeight
../../go/pkg/mod/github.com/lightninglabs/loop@v0.2.3-alpha/lndclient/walletkit_client.go:144:33: undefined: lnwallet.SatPerKWeight
../../go/pkg/mod/github.com/lightninglabs/loop@v0.2.3-alpha/lndclient/walletkit_client.go:176:2: undefined: lnwallet.SatPerKWeight
../../go/pkg/mod/github.com/lightninglabs/loop@v0.2.3-alpha/lndclient/walletkit_client.go:189:9: undefined: lnwallet.SatPerKWeight