lnwire: converge discovery part of messages with specification
Change the name of fields of messages which are belong to the discovery subsystem in a such way so they were the same with the names that are defined in the specification.
This commit is contained in:
1 parent
54b3541707
commit
c3b2854428
19 files changed
+163
-165
No files matched your search
@@ -75,7 +75,7 @@ func createTestNode() (*channeldb.LightningNode, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func randEdgePolicy(chanID lnwire.ChannelID,
|
||||
func randEdgePolicy(chanID lnwire.ShortChannelID,
|
||||
node *channeldb.LightningNode) *channeldb.ChannelEdgePolicy {
|
||||
|
||||
return &channeldb.ChannelEdgePolicy{
|
||||
@@ -90,7 +90,7 @@ func randEdgePolicy(chanID lnwire.ChannelID,
|
||||
}
|
||||
|
||||
func randChannelEdge(ctx *testCtx, chanValue btcutil.Amount,
|
||||
fundingHeight uint32) (*wire.MsgTx, wire.OutPoint, lnwire.ChannelID) {
|
||||
fundingHeight uint32) (*wire.MsgTx, wire.OutPoint, lnwire.ShortChannelID) {
|
||||
|
||||
fundingTx := wire.NewMsgTx(2)
|
||||
fundingTx.TxOut = append(fundingTx.TxOut, &wire.TxOut{
|
||||
@@ -105,7 +105,7 @@ func randChannelEdge(ctx *testCtx, chanValue btcutil.Amount,
|
||||
ctx.chain.addUtxo(chanUtxo, chanValue)
|
||||
|
||||
// Our fake channel will be "confirmed" at height 101.
|
||||
chanID := lnwire.ChannelID{
|
||||
chanID := lnwire.ShortChannelID{
|
||||
BlockHeight: fundingHeight,
|
||||
TxIndex: 0,
|
||||
TxPosition: 0,
|
||||
|
||||
+3
-3
@@ -547,7 +547,7 @@ func (r *ChannelRouter) processUpdate(msg interface{}) error {
|
||||
// Before we can add the channel to the channel graph, we need
|
||||
// to obtain the full funding outpoint that's encoded within
|
||||
// the channel ID.
|
||||
channelID := lnwire.NewChanIDFromInt(msg.ChannelID)
|
||||
channelID := lnwire.NewShortChanIDFromInt(msg.ChannelID)
|
||||
fundingPoint, err := r.fetchChanPoint(&channelID)
|
||||
if err != nil {
|
||||
return errors.Errorf("unable to fetch chan point for "+
|
||||
@@ -580,7 +580,7 @@ func (r *ChannelRouter) processUpdate(msg interface{}) error {
|
||||
fundingPoint, msg.ChannelID)
|
||||
|
||||
case *channeldb.ChannelEdgePolicy:
|
||||
channelID := lnwire.NewChanIDFromInt(msg.ChannelID)
|
||||
channelID := lnwire.NewShortChanIDFromInt(msg.ChannelID)
|
||||
edge1Timestamp, edge2Timestamp, _, err := r.cfg.Graph.HasChannelEdge(msg.ChannelID)
|
||||
if err != nil && err != channeldb.ErrGraphNoEdgesFound {
|
||||
return errors.Errorf("unable to check for edge "+
|
||||
@@ -658,7 +658,7 @@ func (r *ChannelRouter) processUpdate(msg interface{}) error {
|
||||
|
||||
// fetchChanPoint retrieves the original outpoint which is encoded within the
|
||||
// channelID.
|
||||
func (r *ChannelRouter) fetchChanPoint(chanID *lnwire.ChannelID) (*wire.OutPoint, error) {
|
||||
func (r *ChannelRouter) fetchChanPoint(chanID *lnwire.ShortChannelID) (*wire.OutPoint, error) {
|
||||
// First fetch the block hash by the block number encoded, then use
|
||||
// that hash to fetch the block itself.
|
||||
blockNum := int64(chanID.BlockHeight)
|
||||
|
||||
Reference in new issue
Block a user