Skip to content

Commit 9f0890c

Browse files
authored
Merge pull request #1828 from lightninglabs/fix/timestamp-filter-addr-receives
itest: fix address receives test: timestamp in the future
2 parents e157457 + 960cc2b commit 9f0890c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tapdb/addrs.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,12 +989,14 @@ func (t *TapAddressBook) QueryAddrEvents(
989989
ctx context.Context, params address.EventQueryParams) ([]*address.Event,
990990
error) {
991991

992+
now := time.Now().UTC()
992993
sqlQuery := AddrEventQuery{
993994
StatusFrom: int16(address.StatusTransactionDetected),
994995
StatusTo: int16(address.StatusCompleted),
995996
CreatedAfter: time.Unix(0, 0).UTC(),
996-
CreatedBefore: time.Now().UTC(),
997+
CreatedBefore: now,
997998
}
999+
9981000
if len(params.AddrTaprootOutputKey) > 0 {
9991001
sqlQuery.AddrTaprootKey = params.AddrTaprootOutputKey
10001002
}
@@ -1007,6 +1009,9 @@ func (t *TapAddressBook) QueryAddrEvents(
10071009
if params.CreationTimeFrom != nil && !params.CreationTimeFrom.IsZero() {
10081010
sqlQuery.CreatedAfter = params.CreationTimeFrom.UTC()
10091011
}
1012+
if sqlQuery.CreatedAfter.After(now) {
1013+
return []*address.Event{}, nil
1014+
}
10101015
if params.CreationTimeTo != nil && !params.CreationTimeTo.IsZero() {
10111016
sqlQuery.CreatedBefore = params.CreationTimeTo.UTC()
10121017
}

0 commit comments

Comments
 (0)