lint: fix proto message no-copy linter warnings

This commit is contained in:
Andras Banki-Horvath 2021-04-30 12:34:59 +02:00
parent 9aacc35989
commit 80bc46e614
No known key found for this signature in database
GPG Key ID: 80E5375C094198D8
2 changed files with 14 additions and 14 deletions

View File

@ -169,7 +169,7 @@ func (r *RPCAcceptor) Run() error {
defer r.wg.Wait()
// Create a channel that responses from acceptors are sent into.
responses := make(chan lnrpc.ChannelAcceptResponse)
responses := make(chan *lnrpc.ChannelAcceptResponse)
// errChan is used by the receive loop to signal any errors that occur
// during reading from the stream. This is primarily used to shutdown
@ -193,7 +193,7 @@ func (r *RPCAcceptor) Run() error {
// dispatches them into the responses channel provided, sending any errors that
// occur into the error channel provided.
func (r *RPCAcceptor) receiveResponses(errChan chan error,
responses chan lnrpc.ChannelAcceptResponse) {
responses chan *lnrpc.ChannelAcceptResponse) {
for {
resp, err := r.receive()
@ -205,7 +205,7 @@ func (r *RPCAcceptor) receiveResponses(errChan chan error,
var pendingID [32]byte
copy(pendingID[:], resp.PendingChanId)
openChanResp := lnrpc.ChannelAcceptResponse{
openChanResp := &lnrpc.ChannelAcceptResponse{
Accept: resp.Accept,
PendingChanId: pendingID[:],
Error: resp.Error,
@ -236,7 +236,7 @@ func (r *RPCAcceptor) receiveResponses(errChan chan error,
// Accept() function, dispatching them to our acceptor stream and coordinating
// return of responses to their callers.
func (r *RPCAcceptor) sendAcceptRequests(errChan chan error,
responses chan lnrpc.ChannelAcceptResponse) error {
responses chan *lnrpc.ChannelAcceptResponse) error {
// Close the done channel to indicate that the acceptor is no longer
// listening and any in-progress requests should be terminated.
@ -332,7 +332,7 @@ func (r *RPCAcceptor) sendAcceptRequests(errChan chan error,
// acceptor, returning a boolean indicating whether to accept the channel, an
// error to send to the peer, and any validation errors that occurred.
func (r *RPCAcceptor) validateAcceptorResponse(dustLimit btcutil.Amount,
req lnrpc.ChannelAcceptResponse) (bool, error, lnwire.DeliveryAddress,
req *lnrpc.ChannelAcceptResponse) (bool, error, lnwire.DeliveryAddress,
error) {
channelStr := hex.EncodeToString(req.PendingChanId)

View File

@ -27,7 +27,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
tests := []struct {
name string
dustLimit btcutil.Amount
response lnrpc.ChannelAcceptResponse
response *lnrpc.ChannelAcceptResponse
accept bool
acceptorErr error
error error
@ -35,7 +35,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
}{
{
name: "accepted with error",
response: lnrpc.ChannelAcceptResponse{
response: &lnrpc.ChannelAcceptResponse{
Accept: true,
Error: customError.Error(),
},
@ -45,7 +45,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
},
{
name: "custom error too long",
response: lnrpc.ChannelAcceptResponse{
response: &lnrpc.ChannelAcceptResponse{
Accept: false,
Error: strings.Repeat(" ", maxErrorLength+1),
},
@ -55,7 +55,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
},
{
name: "accepted",
response: lnrpc.ChannelAcceptResponse{
response: &lnrpc.ChannelAcceptResponse{
Accept: true,
UpfrontShutdown: validAddr,
},
@ -66,7 +66,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
},
{
name: "rejected with error",
response: lnrpc.ChannelAcceptResponse{
response: &lnrpc.ChannelAcceptResponse{
Accept: false,
Error: customError.Error(),
},
@ -76,7 +76,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
},
{
name: "rejected with no error",
response: lnrpc.ChannelAcceptResponse{
response: &lnrpc.ChannelAcceptResponse{
Accept: false,
},
accept: false,
@ -85,7 +85,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
},
{
name: "invalid upfront shutdown",
response: lnrpc.ChannelAcceptResponse{
response: &lnrpc.ChannelAcceptResponse{
Accept: true,
UpfrontShutdown: "invalid addr",
},
@ -96,7 +96,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
{
name: "reserve too low",
dustLimit: 100,
response: lnrpc.ChannelAcceptResponse{
response: &lnrpc.ChannelAcceptResponse{
Accept: true,
ReserveSat: 10,
},
@ -107,7 +107,7 @@ func TestValidateAcceptorResponse(t *testing.T) {
{
name: "max htlcs too high",
dustLimit: 100,
response: lnrpc.ChannelAcceptResponse{
response: &lnrpc.ChannelAcceptResponse{
Accept: true,
MaxHtlcCount: 1 + input.MaxHTLCNumber/2,
},