mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-24 06:47:44 +01:00
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package rpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/lightningnetwork/lnd/lnrpc/peersrpc"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// =====================
|
|
// PeerClient related RPCs.
|
|
// =====================
|
|
|
|
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)
|
|
require.NoErrorf(h, err, "failed to update announcement")
|
|
|
|
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")
|
|
}
|