lnrpc/peers: handle color changes in updateNodeAnnouncement

This commit is contained in:
positiveblue committed 2022-04-01 18:36:26 -07:00
1 parent ce4813940d
commit aacb2565f5
4 files changed
+37 -1

No files matched your search

+3
View File
@@ -1862,6 +1862,9 @@ func assertAnchorOutputLost(t *harnessTest, node *lntest.HarnessNode,
func assertNodeAnnouncement(t *harnessTest, n1, n2 *lnrpc.NodeUpdate) {
// Alias should match.
require.Equal(t.t, n1.Alias, n2.Alias, "alias don't match")
// Color should match.
require.Equal(t.t, n1.Color, n2.Color, "color don't match")
}
// assertUpdateNodeAnnouncementResponse is a helper function to assert
+5
View File
@@ -821,6 +821,7 @@ func testUpdateNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) {
defaultDaveNodeAnn := &lnrpc.NodeUpdate{
Alias: resp.Alias,
Color: resp.Color,
}
// Dave must have an open channel before he can send a node
@@ -866,15 +867,18 @@ func testUpdateNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) {
// Update Node.
newAlias := "new-alias"
newColor := "#2288ee"
nodeAnnReq := &peersrpc.NodeAnnouncementUpdateRequest{
Alias: newAlias,
Color: newColor,
}
response, err := dave.UpdateNodeAnnouncement(ctxt, nodeAnnReq)
require.NoError(t.t, err, "unable to update dave's node announcement")
expectedOps := map[string]int{
"color": 1,
"alias": 1,
}
assertUpdateNodeAnnouncementResponse(t, response, expectedOps)
@@ -883,6 +887,7 @@ func testUpdateNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) {
// the requested color, requested alias and the new added addresses.
newDaveNodeAnn := &lnrpc.NodeUpdate{
Alias: newAlias,
Color: newColor,
}
// We'll then wait for Alice to receive dave's node announcement