Add field last_update to channels

This commit is contained in:
Yaacov Akiba Slama
2021-04-05 18:31:02 +03:00
parent 8ca6ca87fd
commit ee75d838a1
5 changed files with 11 additions and 7 deletions

View File

@@ -53,13 +53,14 @@ func channelsSynchronizeOnce() error {
return fmt.Errorf("client.ListChannels() error: %w", err)
}
log.Printf("channelsSynchronizeOnce - received channels")
lastUpdate := time.Now()
for _, c := range channels.Channels {
nodeID, err := hex.DecodeString(c.RemotePubkey)
if err != nil {
log.Printf("hex.DecodeString in channelsSynchronizeOnce error: %v", err)
continue
}
err = insertChannel(c.ChanId, c.ChannelPoint, nodeID)
err = insertChannel(c.ChanId, c.ChannelPoint, nodeID, lastUpdate)
if err != nil {
log.Printf("insertChannel(%v, %v, %x) in channelsSynchronizeOnce error: %v", c.ChanId, c.ChannelPoint, nodeID, err)
continue