Skip to content

Commit 51b0ea4

Browse files
committed
staticaddr: fix swap amount in listswaps command
1 parent 7a0ca64 commit 51b0ea4

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

1928+
swapAmount := swp.TotalDepositAmount()
19281929
state := toClientStaticAddressLoopInState(swp.GetState())
1929-
swapAmount := int64(swp.TotalDepositAmount())
19301930
payReqAmount := int64(swapPayReq.MilliSat.ToSatoshis())
1931+
if swp.SelectedAmount > 0 {
1932+
swapAmount = swp.SelectedAmount
1933+
}
19311934
swap := &looprpc.StaticAddressLoopInSwap{
19321935
SwapHash: swp.SwapHash[:],
19331936
DepositOutpoints: swp.DepositOutpoints,
19341937
State: state,
1935-
SwapAmountSatoshis: swapAmount,
1938+
SwapAmountSatoshis: int64(swapAmount),
19361939
PaymentRequestAmountSatoshis: payReqAmount,
19371940
Deposits: protoDeposits,
19381941
}
@@ -1945,9 +1948,9 @@ func (s *swapClientServer) ListStaticAddressSwaps(ctx context.Context,
19451948
}, nil
19461949
}
19471950

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

0 commit comments

Comments
 (0)