funding: dont's send ErrorCode on wire

Since the ErrorCodes are not part of the spec, they cannot be read by
other implementations.

Instead of only sending the error code we therefore send the complete
error message. This will have the same effect at the client, as it will
just get the full error instead of the code indicating which error it
is. It will also be compatible with other impls.

Note that the GRPC error codes will change, since we don't set them
anymore.
This commit is contained in:
Johan T. Halseth
2019-09-20 10:55:20 +02:00
parent 20a5ee2f1e
commit ff37b711c6
2 changed files with 10 additions and 24 deletions

View File

@@ -42,7 +42,6 @@ import (
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
var (
@@ -6160,7 +6159,9 @@ func testMaxPendingChannels(net *lntest.NetworkHarness, t *harnessTest) {
if err == nil {
t.Fatalf("error wasn't received")
} else if grpc.Code(err) != lnwire.ErrMaxPendingChannels.ToGrpcCode() {
} else if !strings.Contains(
err.Error(), lnwire.ErrMaxPendingChannels.Error(),
) {
t.Fatalf("not expected error was received: %v", err)
}