lncli: start_time defaults to 24 hours ago

Here we set start_time to 24 hours prior
if it's not provided on the CLI.  The
effect of this is when you don't provide
a start_time:

CLI: -24h
RPC: Unix Epoch
This commit is contained in:
tyzbit 2019-10-03 18:12:39 -04:00
parent 8891346cb2
commit be989a85ff

@ -15,6 +15,7 @@ import (
"strings" "strings"
"sync" "sync"
"syscall" "syscall"
"time"
"github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcd/wire"
@ -3532,7 +3533,7 @@ var forwardingHistoryCommand = cli.Command{
payment circuits (HTLCs) over a particular time range (--start_time and payment circuits (HTLCs) over a particular time range (--start_time and
--end_time). The start and end times are meant to be expressed in --end_time). The start and end times are meant to be expressed in
seconds since the Unix epoch. If --start_time isn't provided, seconds since the Unix epoch. If --start_time isn't provided,
then the Unix epoch (01-01-1970) is used. If --end_time isn't provided, then 24 hours ago is used. If --end_time isn't provided,
then the current time is used. then the current time is used.
The max number of events returned is 50k. The default number is 100, The max number of events returned is 50k. The default number is 100,
@ -3586,6 +3587,9 @@ func forwardingHistory(ctx *cli.Context) error {
return fmt.Errorf("unable to decode start_time %v", err) return fmt.Errorf("unable to decode start_time %v", err)
} }
args = args.Tail() args = args.Tail()
default:
now := time.Now()
startTime = uint64(now.Add(-time.Hour * 24).Unix())
} }
switch { switch {