2022-07-22 02:18:18 +02:00
|
|
|
package rpc
|
|
|
|
|
2022-08-04 00:59:21 +02:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/lightningnetwork/lnd/lnrpc/peersrpc"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2022-07-22 02:18:18 +02:00
|
|
|
// =====================
|
|
|
|
// PeerClient related RPCs.
|
|
|
|
// =====================
|
2022-08-04 00:59:21 +02:00
|
|
|
|
|
|
|
type (
|
|
|
|
AnnReq *peersrpc.NodeAnnouncementUpdateRequest
|
|
|
|
AnnResp *peersrpc.NodeAnnouncementUpdateResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
// UpdateNodeAnnouncement makes an UpdateNodeAnnouncement RPC call the the
|
|
|
|
// peersrpc client and asserts.
|
|
|
|
func (h *HarnessRPC) UpdateNodeAnnouncement(req AnnReq) AnnResp {
|
|
|
|
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
resp, err := h.Peer.UpdateNodeAnnouncement(ctxt, req)
|
2022-08-18 14:49:16 +02:00
|
|
|
h.NoError(err, "UpdateNodeAnnouncement")
|
2022-08-04 00:59:21 +02:00
|
|
|
|
|
|
|
return resp
|
|
|
|
}
|
|
|
|
|
|
|
|
// UpdateNodeAnnouncementErr makes an UpdateNodeAnnouncement RPC call the the
|
|
|
|
// peersrpc client and asserts an error is returned.
|
|
|
|
func (h *HarnessRPC) UpdateNodeAnnouncementErr(req AnnReq) {
|
|
|
|
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
_, err := h.Peer.UpdateNodeAnnouncement(ctxt, req)
|
|
|
|
require.Error(h, err, "expect an error from update announcement")
|
|
|
|
}
|