Skip to content

Commit f53ea73

Browse files
committed
fix lnd-client tests
1 parent 5335613 commit f53ea73

File tree

6 files changed

+33
-25
lines changed

6 files changed

+33
-25
lines changed

pub/lnd-client/.ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.stack-work
2+
src/Proto

pub/lnd-client/lnd-client.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ test-suite lnd-client-test
444444
async
445445
, base >=4.7 && <5
446446
, containers
447+
, functora
447448
, hspec
448449
, unliftio
449450
default-language: Haskell2010
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
let
2-
header = import ./header.nix;
3-
proto-lens-src = fetchGit {
4-
url = "https://github.com/coingaming/proto-lens.git";
5-
ref = "master";
6-
rev = "7e75e2c95d9bf608965ff8335ee618978181034a";
7-
};
8-
proto-lens-protoc = header.pkgs.haskell-nix.project {
9-
src = "${proto-lens-src}/proto-lens-protoc";
10-
compiler-nix-name = "ghc902";
2+
src = fetchTarball {
3+
url = "https://github.com/functora/functora.github.io/archive/53356131206ffdc2eae2f1a18f55333ef3465639.tar.gz";
4+
sha256 = "1qsg53kakcjpk1qn2vwj90ypwynqw6zvj224664498a6mxl6j868";
115
};
6+
prj = import "${src}/nix/project.nix" {};
127
in
13-
proto-lens-protoc.hsPkgs.proto-lens-protoc.components.exes.proto-lens-protoc
8+
prj.proto-lens-protoc.components.exes.proto-lens-protoc

pub/lnd-client/package.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,5 @@ tests:
185185
- unliftio
186186
- containers
187187
- hspec
188+
- functora
188189
<<: *ghcid

pub/lnd-client/shell.nix

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
extraBuildInputs ? [],
3-
withShellHook ? false,
3+
withShellHook ? true,
44
profile ? false,
55
}: let
66
# project = import ./default.nix {inherit profile;};
@@ -9,7 +9,7 @@
99
# pkgs = header.pkgs;
1010
# nixPkgsLegacy = header.nixPkgsLegacy;
1111
# lnd = import ./nix/lnd.nix {inherit pkgs;};
12-
# proto-lens-protoc = import ./nix/proto-lens-protoc.nix;
12+
proto-lens-protoc = import ./nix/proto-lens-protoc.nix;
1313
project = import ../../nix/project.nix {};
1414
pkgs = project.pkgs;
1515
in
@@ -23,17 +23,16 @@ in
2323
# haskellPackages.hpack
2424
# haskellPackages.stack
2525
# haskellPackages.hp2pretty
26-
# pkgs.bitcoin
27-
# pkgs.openssl
28-
# pkgs.expect
29-
# pkgs.ps
30-
# pkgs.jq
3126
# pkgs.ormolu
3227
# pkgs.niv
33-
# lnd
28+
pkgs.bitcoin
29+
pkgs.openssl
30+
pkgs.expect
31+
pkgs.ps
32+
pkgs.jq
33+
pkgs.lnd
3434
pkgs.protobuf
35-
# proto-lens-protoc
36-
project.proto-lens-protoc.components.exes.proto-lens-protoc
35+
proto-lens-protoc
3736
]
3837
++ extraBuildInputs;
3938
tools = {

pub/lnd-client/src/LndClient/Data/ChannelPoint.hs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,25 @@ channelPointParser x =
5959
Right txidHex -> do
6060
idxTS <-
6161
first
62-
( const
63-
$ FromGrpcError "Invalid ChannelPoint outputIndex"
62+
( \e ->
63+
FromGrpcError
64+
$ "Invalid ChannelPoint outputIndex BS "
65+
<> inspect idxBS
66+
<> " "
67+
<> show e
6468
)
6569
$ decodeUtf8' idxBS
6670
ChannelPoint (TxId $ BS.reverse txidHex)
67-
<$> maybeToRight
68-
(FromGrpcError "Invalid ChannelPoint outputIndex")
69-
(readMaybe $ TS.unpack idxTS)
71+
<$> maybe
72+
( Left
73+
. FromGrpcError
74+
$ "Invalid ChannelPoint outputIndex TS "
75+
<> inspect idxTS
76+
)
77+
( Right . Vout
78+
)
79+
( readMaybe $ TS.unpack idxTS
80+
)
7081
Left {} ->
7182
Left $ FromGrpcError "Invalid ChannelPoint fundingTxidBytes"
7283
_ ->

0 commit comments

Comments
 (0)