discovery/chan_series: use netann.ChannelUpdateFromEdge helper

This commit is contained in:
Conner Fromknecht 2020-03-17 16:24:25 -07:00
parent 7b0d564692
commit 089ac647d8
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -324,20 +324,7 @@ func (c *ChanSeries) FetchChanUpdates(chain chainhash.Hash,
chanUpdates := make([]*lnwire.ChannelUpdate, 0, 2)
if e1 != nil {
chanUpdate := &lnwire.ChannelUpdate{
ChainHash: chanInfo.ChainHash,
ShortChannelID: shortChanID,
Timestamp: uint32(e1.LastUpdate.Unix()),
MessageFlags: e1.MessageFlags,
ChannelFlags: e1.ChannelFlags,
TimeLockDelta: e1.TimeLockDelta,
HtlcMinimumMsat: e1.MinHTLC,
HtlcMaximumMsat: e1.MaxHTLC,
BaseFee: uint32(e1.FeeBaseMSat),
FeeRate: uint32(e1.FeeProportionalMillionths),
ExtraOpaqueData: e1.ExtraOpaqueData,
}
chanUpdate.Signature, err = lnwire.NewSigFromRawSignature(e1.SigBytes)
chanUpdate, err := netann.ChannelUpdateFromEdge(chanInfo, e1)
if err != nil {
return nil, err
}
@ -345,20 +332,7 @@ func (c *ChanSeries) FetchChanUpdates(chain chainhash.Hash,
chanUpdates = append(chanUpdates, chanUpdate)
}
if e2 != nil {
chanUpdate := &lnwire.ChannelUpdate{
ChainHash: chanInfo.ChainHash,
ShortChannelID: shortChanID,
Timestamp: uint32(e2.LastUpdate.Unix()),
MessageFlags: e2.MessageFlags,
ChannelFlags: e2.ChannelFlags,
TimeLockDelta: e2.TimeLockDelta,
HtlcMinimumMsat: e2.MinHTLC,
HtlcMaximumMsat: e2.MaxHTLC,
BaseFee: uint32(e2.FeeBaseMSat),
FeeRate: uint32(e2.FeeProportionalMillionths),
ExtraOpaqueData: e2.ExtraOpaqueData,
}
chanUpdate.Signature, err = lnwire.NewSigFromRawSignature(e2.SigBytes)
chanUpdate, err := netann.ChannelUpdateFromEdge(chanInfo, e2)
if err != nil {
return nil, err
}