Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ rpc:

rpc-check: rpc
@$(call print, "Verifying protos.")
if test -n "$$(git describe --dirty | grep dirty)"; then echo "Protos not properly formatted or not compiled with correct version!"; git status; git diff; exit 1; fi
if test -n "$$(git status --porcelain)"; then echo "Protos not properly formatted or not compiled with correct version!"; git status; git diff; exit 1; fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡


rpc-js-compile:
@$(call print, "Compiling JSON/WASM stubs.")
Expand Down Expand Up @@ -135,8 +135,11 @@ mod-tidy:

mod-check:
@$(call print, "Checking modules.")
$(GOMOD) tidy
if test -n "$$(git status | grep -e "go.mod\|go.sum")"; then echo "Running go mod tidy changes go.mod/go.sum"; git status; git diff; exit 1; fi
GOPROXY=direct $(GOMOD) tidy
cd swapserverrpc/ && GOPROXY=direct $(GOMOD) tidy
cd looprpc/ && GOPROXY=direct $(GOMOD) tidy
cd tools/ && GOPROXY=direct $(GOMOD) tidy
if test -n "$$(git status --porcelain)"; then echo "Running go mod tidy changes go.mod/go.sum"; git status; git diff; exit 1; fi

sqlc:
@$(call print, "Generating sql models and queries in Go")
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ require (
github.com/lightninglabs/aperture v0.3.8-beta
github.com/lightninglabs/lndclient v0.19.0-2
github.com/lightninglabs/loop/looprpc v1.0.0
github.com/lightninglabs/loop/swapserverrpc v1.0.11
// TODO(guggero): Update this to a commit in master.
github.com/lightninglabs/taproot-assets v0.5.2-0.20250306114727-f0691d155619
github.com/lightninglabs/loop/swapserverrpc v1.0.13
github.com/lightninglabs/taproot-assets v0.5.2-0.20250311211321-3793cf066af7
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20250304192711-9feb761b4ec4
github.com/lightningnetwork/lnd/cert v1.2.2
github.com/lightningnetwork/lnd/clock v1.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1139,8 +1139,8 @@ github.com/lightninglabs/neutrino/cache v1.1.2 h1:C9DY/DAPaPxbFC+xNNEI/z1SJY9GS3
github.com/lightninglabs/neutrino/cache v1.1.2/go.mod h1:XJNcgdOw1LQnanGjw8Vj44CvguYA25IMKjWFZczwZuo=
github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display h1:w7FM5LH9Z6CpKxl13mS48idsu6F+cEZf0lkyiV+Dq9g=
github.com/lightninglabs/protobuf-go-hex-display v1.34.2-hex-display/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
github.com/lightninglabs/taproot-assets v0.5.2-0.20250306114727-f0691d155619 h1:GrWJ7yA8YQuh6wf98qA8TF9jkOvH0D9tdM9tSxpFnnc=
github.com/lightninglabs/taproot-assets v0.5.2-0.20250306114727-f0691d155619/go.mod h1:+EoY8qorrcrutZeX9S5lqI76CbPewbM2B6P2O2gEZL4=
github.com/lightninglabs/taproot-assets v0.5.2-0.20250311211321-3793cf066af7 h1:CGOClQ1aEXe2W1ZTaEZr8LUBtD6HaBYc6ZydvTY8A4M=
github.com/lightninglabs/taproot-assets v0.5.2-0.20250311211321-3793cf066af7/go.mod h1:+EoY8qorrcrutZeX9S5lqI76CbPewbM2B6P2O2gEZL4=
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb h1:yfM05S8DXKhuCBp5qSMZdtSwvJ+GFzl94KbXMNB1JDY=
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI=
github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20250304192711-9feb761b4ec4 h1:3UfT25sO71q3V7RSb/wE0ruiwk3ex30h7ZvPZ0O2Z80=
Expand Down
4 changes: 2 additions & 2 deletions loopd/swapclient_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ func (s *swapClientServer) WithdrawDeposits(ctx context.Context,
}
}

txhash, pkScript, err := s.withdrawalManager.DeliverWithdrawalRequest(
txhash, address, err := s.withdrawalManager.DeliverWithdrawalRequest(
ctx, outpoints, req.DestAddr, req.SatPerVbyte, req.Amount,
)
if err != nil {
Expand All @@ -1589,7 +1589,7 @@ func (s *swapClientServer) WithdrawDeposits(ctx context.Context,

return &looprpc.WithdrawDepositsResponse{
WithdrawalTxHash: txhash,
PkScript: pkScript,
Address: address,
}, err
}

Expand Down
884 changes: 442 additions & 442 deletions looprpc/client.pb.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions looprpc/client.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1678,9 +1678,9 @@ message WithdrawDepositsResponse {
string withdrawal_tx_hash = 1;

/*
The pkscript of the withdrawal transaction.
The destination address of the withdrawal transaction.
*/
string pk_script = 2;
string address = 2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note: this is a breaking change for json clients, but I don't think this is a problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, I think it's not a problem atm.

}

message OutPoint {
Expand Down
6 changes: 3 additions & 3 deletions looprpc/client.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@
"next_start_time": {
"type": "string",
"format": "int64",
"description": "Timestamp of the last swap returned."
"description": "Timestamp to use for paging start_timestamp_ns."
}
}
},
Expand Down Expand Up @@ -2132,9 +2132,9 @@
"type": "string",
"description": "The transaction hash of the withdrawal transaction."
},
"pk_script": {
"address": {
"type": "string",
"description": "The pkscript of the withdrawal transaction."
"description": "The destination address of the withdrawal transaction."
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion looprpc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.23.7

require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3
github.com/lightninglabs/loop/swapserverrpc v1.0.11
github.com/lightninglabs/loop/swapserverrpc v1.0.13
google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.34.2
)
Expand Down
4 changes: 2 additions & 2 deletions looprpc/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,8 @@ github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NB
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lightninglabs/loop/swapserverrpc v1.0.11 h1:R/8c/bo4rpqm5/cfi944rj24oQUlZu+xXjzMhEDSkrc=
github.com/lightninglabs/loop/swapserverrpc v1.0.11/go.mod h1:Ml3gMwe/iTRLvu1QGGZzXcr0DYSa9sJGwKPktLaWtwE=
github.com/lightninglabs/loop/swapserverrpc v1.0.13 h1:Qf4L8QBJKzhKRcC8dpvfrrBEXJMF3+XbpomAHEJsRDY=
github.com/lightninglabs/loop/swapserverrpc v1.0.13/go.mod h1:Ml3gMwe/iTRLvu1QGGZzXcr0DYSa9sJGwKPktLaWtwE=
github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o=
Expand Down
14 changes: 7 additions & 7 deletions staticaddr/loopin/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/lightninglabs/loop/staticaddr/deposit"
"github.com/lightninglabs/loop/staticaddr/version"
"github.com/lightninglabs/loop/swap"
looprpc "github.com/lightninglabs/loop/swapserverrpc"
"github.com/lightninglabs/loop/swapserverrpc"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/invoices"
Expand Down Expand Up @@ -117,7 +117,7 @@ func (f *FSM) InitHtlcAction(ctx context.Context,
version.CurrentRPCProtocolVersion(),
)

loopInReq := &looprpc.ServerStaticAddressLoopInRequest{
loopInReq := &swapserverrpc.ServerStaticAddressLoopInRequest{
SwapHash: f.loopIn.SwapHash[:],
DepositOutpoints: f.loopIn.DepositOutpoints,
HtlcClientPubKey: f.loopIn.ClientPubkey.SerializeCompressed(),
Expand All @@ -144,7 +144,7 @@ func (f *FSM) InitHtlcAction(ctx context.Context,
// attempt.
pushEmptySigs := func() {
_, err = f.cfg.Server.PushStaticAddressHtlcSigs(
ctx, &looprpc.PushStaticAddressHtlcSigsRequest{
ctx, &swapserverrpc.PushStaticAddressHtlcSigsRequest{
SwapHash: f.loopIn.SwapHash[:],
},
)
Expand Down Expand Up @@ -382,17 +382,17 @@ func (f *FSM) SignHtlcTxAction(ctx context.Context,
}

// Push htlc tx sigs to server.
pushHtlcReq := &looprpc.PushStaticAddressHtlcSigsRequest{
pushHtlcReq := &swapserverrpc.PushStaticAddressHtlcSigsRequest{
SwapHash: f.loopIn.SwapHash[:],
StandardHtlcInfo: &looprpc.ClientHtlcSigningInfo{
StandardHtlcInfo: &swapserverrpc.ClientHtlcSigningInfo{
Nonces: clientHtlcNonces,
Sigs: htlcSigs,
},
HighFeeHtlcInfo: &looprpc.ClientHtlcSigningInfo{
HighFeeHtlcInfo: &swapserverrpc.ClientHtlcSigningInfo{
Nonces: highFeeNonces,
Sigs: htlcSigsHighFee,
},
ExtremeFeeHtlcInfo: &looprpc.ClientHtlcSigningInfo{
ExtremeFeeHtlcInfo: &swapserverrpc.ClientHtlcSigningInfo{
Nonces: extremelyHighNonces,
Sigs: htlcSigsExtremelyHighFee,
},
Expand Down
12 changes: 6 additions & 6 deletions staticaddr/loopin/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/lightninglabs/loop/labels"
"github.com/lightninglabs/loop/staticaddr/deposit"
"github.com/lightninglabs/loop/swapserverrpc"
looprpc "github.com/lightninglabs/loop/swapserverrpc"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/routing/route"
)
Expand All @@ -34,7 +33,7 @@ const (
type Config struct {
// Server is the client that is used to communicate with the static
// address server.
Server looprpc.StaticAddressServerClient
Server swapserverrpc.StaticAddressServerClient

// AddressManager gives the withdrawal manager access to static address
// parameters.
Expand Down Expand Up @@ -232,7 +231,7 @@ func (m *Manager) notifyNotFinished(ctx context.Context, swapHash lntypes.Hash,
txId chainhash.Hash) error {

_, err := m.cfg.Server.PushStaticAddressSweeplessSigs(
ctx, &looprpc.PushStaticAddressSweeplessSigsRequest{
ctx, &swapserverrpc.PushStaticAddressSweeplessSigsRequest{
SwapHash: swapHash[:],
Txid: txId[:],
ErrorMessage: SwapNotFinishedMsg,
Expand Down Expand Up @@ -332,7 +331,7 @@ func (m *Manager) handleLoopInSweepReq(ctx context.Context,

// We'll now sign for every deposit that is part of the loop-in.
responseMap := make(
map[string]*looprpc.ClientSweeplessSigningInfo,
map[string]*swapserverrpc.ClientSweeplessSigningInfo,
len(req.DepositToNonces),
)

Expand Down Expand Up @@ -394,16 +393,17 @@ func (m *Manager) handleLoopInSweepReq(ctx context.Context,
return err
}

responseMap[depositOutpoint] = &looprpc.ClientSweeplessSigningInfo{ //nolint:lll
signingInfo := &swapserverrpc.ClientSweeplessSigningInfo{
Nonce: musig2Session.PublicNonce[:],
Sig: sig,
}
responseMap[depositOutpoint] = signingInfo
}

txHash := sweepTx.TxHash()

_, err = m.cfg.Server.PushStaticAddressSweeplessSigs(
ctx, &looprpc.PushStaticAddressSweeplessSigsRequest{
ctx, &swapserverrpc.PushStaticAddressSweeplessSigsRequest{
SwapHash: loopIn.SwapHash[:],
Txid: txHash[:],
SigningInfo: responseMap,
Expand Down
20 changes: 8 additions & 12 deletions staticaddr/withdraw/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ type newWithdrawalRequest struct {
// newWithdrawalResponse is used to return withdrawal info and error to the
// server.
type newWithdrawalResponse struct {
txHash string
withdrawalPkScript string
err error
txHash string
withdrawalAddress string
err error
}

// Manager manages the withdrawal state machines.
Expand Down Expand Up @@ -147,10 +147,6 @@ func (m *Manager) Run(ctx context.Context) error {
// initialization.
close(m.initChan)

var (
txHash string
pkScript string
)
for {
select {
case <-newBlockChan:
Expand All @@ -161,7 +157,7 @@ func (m *Manager) Run(ctx context.Context) error {
}

case req := <-m.newWithdrawalRequestChan:
txHash, pkScript, err = m.WithdrawDeposits(
txHash, withdrawalAddress, err := m.WithdrawDeposits(
ctx, req.outpoints, req.destAddr,
req.satPerVbyte, req.amount,
)
Expand All @@ -173,9 +169,9 @@ func (m *Manager) Run(ctx context.Context) error {
// We forward the initialized loop-in and error to
// DeliverLoopInRequest.
resp := &newWithdrawalResponse{
txHash: txHash,
withdrawalPkScript: pkScript,
err: err,
txHash: txHash,
withdrawalAddress: withdrawalAddress,
err: err,
}
select {
case req.respChan <- resp:
Expand Down Expand Up @@ -956,7 +952,7 @@ func (m *Manager) DeliverWithdrawalRequest(ctx context.Context,
// Wait for the response from the manager run loop.
select {
case resp := <-request.respChan:
return resp.txHash, resp.withdrawalPkScript, resp.err
return resp.txHash, resp.withdrawalAddress, resp.err

case <-m.exitChan:
return "", "", fmt.Errorf("withdrawal manager has been " +
Expand Down