mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 12:44:19 +01:00
Fix dangling payments (#58)
This commit is contained in:
committed by
GitHub
parent
3985bd4e14
commit
6d00ee280c
@@ -53,10 +53,6 @@ func (m *paymentsMap) pop(num int64) []domain.Payment {
|
||||
m.lock.Lock()
|
||||
defer m.lock.Unlock()
|
||||
|
||||
if num < 0 || num > int64(len(m.payments)) {
|
||||
num = int64(len(m.payments))
|
||||
}
|
||||
|
||||
paymentsByTime := make([]timedPayment, 0, len(m.payments))
|
||||
for _, p := range m.payments {
|
||||
// Skip payments without registered receivers.
|
||||
@@ -73,6 +69,10 @@ func (m *paymentsMap) pop(num int64) []domain.Payment {
|
||||
return paymentsByTime[i].timestamp.Before(paymentsByTime[j].timestamp)
|
||||
})
|
||||
|
||||
if num < 0 || num > int64(len(paymentsByTime)) {
|
||||
num = int64(len(paymentsByTime))
|
||||
}
|
||||
|
||||
payments := make([]domain.Payment, 0, num)
|
||||
for _, p := range paymentsByTime[:num] {
|
||||
payments = append(payments, p.Payment)
|
||||
|
||||
Reference in New Issue
Block a user