This commit moves the RequiredPermissions map to its own directory so
that projects importing the permissions list dont need to import all the
dependencies of the pool package.
Since the code for creating and using a macaroon service is the same for
multiple projects (pool, loop, litd etc), the code has been unified in
lndclient. So this commit removes the macaroon service code and instead
uses the lndclient code.
In the integration tests we stop the pool daemon but don't exit the main
process. So it can happen that the underlying bbolt DB isn't properly
closed and when the daemon is started again during the test it runs into
a timeout. We fix this by properly closing the DB when the service is
stopped.
The macaroon service doesn't close the backend anymore because in the
lnd context the backend connection could be a shared connection to a
remote DB that we don't want to close when we start/stop the service
itself.
With this commit we add two new RPCs for handling sidecar tickets.
ListSidecars will show all sidecar tickets known to the local database,
including those where our node is on the receiving end of a sidecar
channel.
CancelSidecar will cancel a specific sidecar ticket. If an order was
created for it, that bid order will be canceled. Doing so will make sure
the ticket isn't executed any further.
To make it possible to decode a sidecar ticket through RPC instead of
only relying on the output of the CLI, we add the DecodeSidecarTicket
RPC method to the trader daemon.
We create an RPC wrapper around the new order.NewQuote function with the
goal of replacing the calculation that currently only exists in the CLI
with an actual RPC call.
To make sure we don't just block for forever if another Pool daemon
process is already running, we add a timeout and error out if obtaining
the unique file lock fails after 5 seconds.
With this commit we add the ability to both create/expect a sidecar offer as a
provider as well as registering an offer as the recipient to the main
RPC server.
This commit adds the required macaroon permissions for the two new RPC
methods added in the previous commit.
We don't want to introduce a new permission that didn't exist before
because that would mean all users would need to re-create their macaroon
to use the commands. Therefore we use the account:write permission for
the shutdown command as that is probably the most sensitive permission
anyway as it gives access to on-chain funds.
To make sure we can use the latest version of pool in LiT, we need to
make sure pool compiles against the actual v0.11.1 branch of lnd. There
were some conflicting changes to the macaroon service that didn't make
it to the branch that we need to roll back. Those changes don't affect
pool at all as we were always using the default root key ID anyway.