mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 00:53:05 +02:00
rpcserver: startTime defaults to the unix epoch
Fixes https://github.com/lightningnetwork/lnd/issues/3357. When start_time isn't specified, its default value is 0. This meant when users explicitly specified a start_time of 0, we would incorrectly set start_time to 24 hours in the past. Now, n0 means n0.
This commit is contained in:
@@ -4637,13 +4637,8 @@ func (r *rpcServer) ForwardingHistory(ctx context.Context,
|
||||
numEvents uint32
|
||||
)
|
||||
|
||||
// If the start time wasn't specified, we'll default to 24 hours ago.
|
||||
if req.StartTime == 0 {
|
||||
now := time.Now()
|
||||
startTime = now.Add(-time.Hour * 24)
|
||||
} else {
|
||||
startTime = time.Unix(int64(req.StartTime), 0)
|
||||
}
|
||||
// startTime defaults to the Unix epoch (0 unixtime, or midnight 01-01-1970).
|
||||
startTime = time.Unix(int64(req.StartTime), 0)
|
||||
|
||||
// If the end time wasn't specified, assume a default end time of now.
|
||||
if req.EndTime == 0 {
|
||||
|
Reference in New Issue
Block a user