Skip to content

Commit dc56779

Browse files
committed
staticaddr: fix swap amount in listswaps command
1 parent 59f31d7 commit dc56779

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
@@ -1924,14 +1924,17 @@ func (s *swapClientServer) ListStaticAddressSwaps(ctx context.Context,
19241924
}
19251925
}
19261926

1927+
swapAmount := swp.TotalDepositAmount()
19271928
state := toClientStaticAddressLoopInState(swp.GetState())
1928-
swapAmount := int64(swp.TotalDepositAmount())
19291929
payReqAmount := int64(swapPayReq.MilliSat.ToSatoshis())
1930+
if swp.SelectedAmount > 0 {
1931+
swapAmount = swp.SelectedAmount
1932+
}
19301933
swap := &looprpc.StaticAddressLoopInSwap{
19311934
SwapHash: swp.SwapHash[:],
19321935
DepositOutpoints: swp.DepositOutpoints,
19331936
State: state,
1934-
SwapAmountSatoshis: swapAmount,
1937+
SwapAmountSatoshis: int64(swapAmount),
19351938
PaymentRequestAmountSatoshis: payReqAmount,
19361939
Deposits: protoDeposits,
19371940
}
@@ -1944,9 +1947,9 @@ func (s *swapClientServer) ListStaticAddressSwaps(ctx context.Context,
19441947
}, nil
19451948
}
19461949

1947-
// GetStaticAddressSummary returns a summary static address related information.
1948-
// Amongst deposits and withdrawals and their total values it also includes a
1949-
// list of detailed deposit information filtered by their state.
1950+
// GetStaticAddressSummary returns a summary of static address-related
1951+
// information. Amongst deposits and withdrawals and their total values, it also
1952+
// includes a list of detailed deposit information filtered by their state.
19501953
func (s *swapClientServer) GetStaticAddressSummary(ctx context.Context,
19511954
_ *looprpc.StaticAddressSummaryRequest) (
19521955
*looprpc.StaticAddressSummaryResponse, error) {

0 commit comments

Comments
 (0)