Skip to content

Commit 6a37e83

Browse files
committed
staticaddr: fix swap amount in listswaps command
1 parent 1fc127e commit 6a37e83

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

loopd/swapclient_server.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,14 +1868,17 @@ func (s *swapClientServer) ListStaticAddressSwaps(ctx context.Context,
18681868
}
18691869
}
18701870

1871+
swapAmount := swp.TotalDepositAmount()
18711872
state := toClientStaticAddressLoopInState(swp.GetState())
1872-
swapAmount := int64(swp.TotalDepositAmount())
18731873
payReqAmount := int64(swapPayReq.MilliSat.ToSatoshis())
1874+
if swp.SelectedAmount > 0 {
1875+
swapAmount = swp.SelectedAmount
1876+
}
18741877
swap := &looprpc.StaticAddressLoopInSwap{
18751878
SwapHash: swp.SwapHash[:],
18761879
DepositOutpoints: swp.DepositOutpoints,
18771880
State: state,
1878-
SwapAmountSatoshis: swapAmount,
1881+
SwapAmountSatoshis: int64(swapAmount),
18791882
PaymentRequestAmountSatoshis: payReqAmount,
18801883
Deposits: protoDeposits,
18811884
}
@@ -1888,9 +1891,9 @@ func (s *swapClientServer) ListStaticAddressSwaps(ctx context.Context,
18881891
}, nil
18891892
}
18901893

1891-
// GetStaticAddressSummary returns a summary static address related information.
1892-
// Amongst deposits and withdrawals and their total values it also includes a
1893-
// list of detailed deposit information filtered by their state.
1894+
// GetStaticAddressSummary returns a summary of static address-related
1895+
// information. Amongst deposits and withdrawals and their total values, it also
1896+
// includes a list of detailed deposit information filtered by their state.
18941897
func (s *swapClientServer) GetStaticAddressSummary(ctx context.Context,
18951898
_ *looprpc.StaticAddressSummaryRequest) (
18961899
*looprpc.StaticAddressSummaryResponse, error) {

0 commit comments

Comments
 (0)