Skip to content

Commit 134bff1

Browse files
authored
Merge pull request joemphilips#93 from joemphilips/fix_ci
use dotnet run to run expecto tests
2 parents 9624ea6 + 376f166 commit 134bff1

File tree

4 files changed

+15
-24
lines changed

4 files changed

+15
-24
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,24 @@ jobs:
1919
# we want to run only once.
2020
if: startsWith(matrix.os, 'ubuntu-18')
2121
run: |
22-
dotnet test tests/DotNetLightning.Core.Tests -p:BouncyCastle=True
22+
dotnet build tests/DotNetLightning.Core.Tests -p:BouncyCastle=True
23+
dotnet run --project tests/DotNetLightning.Core.Tests
2324
- name: Run Infrastructure tests on BouncyCastle
2425
# we want to run only once.
2526
if: startsWith(matrix.os, 'ubuntu-18')
2627
run: |
27-
dotnet test tests/DotNetLightning.Infrastructure.Tests -p:BouncyCastle=True
28+
dotnet build tests/DotNetLightning.Infrastructure.Tests -p:BouncyCastle=True
29+
dotnet run --project tests/DotNetLightning.Infrastructure.Tests
2830
2931
- name: Clean to prepare for NSec build
3032
run: |
3133
dotnet clean
32-
- name: Run tests
34+
- name: Run core tests
35+
run: |
36+
dotnet run --project tests/DotNetLightning.Core.Tests
37+
- name: Run Infrastructure tests
38+
run: |
39+
dotnet run --project tests/DotNetLightning.Infrastructure.Tests
40+
- name: Run other tests
3341
run: |
3442
dotnet test

src/DotNetLightning.Core/Serialize/Msgs/Msgs.fs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -390,25 +390,10 @@ type Init =
390390
this.Features <- oredFeatures |> FeatureBit.CreateUnsafe
391391
this.TLVStream <- ls.ReadTLVStream() |> Array.map(InitTLV.FromGenericTLV)
392392
member this.Serialize(ls) =
393-
// Trim any leading zero bytes from the from of the local features
394-
let localFeatures =
395-
let features = this.Features.ToByteArray()
396-
let startIndex =
397-
match Array.tryFindIndex (fun (b: byte) -> b <> 0uy) features with
398-
| Some index -> index
399-
| None -> features.Length
400-
features.[startIndex..]
401-
// For legacy compatibility, the last (lowest) 13 bits get
402-
// duplicated in the globalFeatures array.
403-
let globalFeatures =
404-
if localFeatures.Length < 2 then
405-
localFeatures
406-
else
407-
let features = localFeatures.[(localFeatures.Length - 2)..]
408-
features.[0] <- features.[0] &&& 0b00111111uy
409-
features
410-
ls.WriteWithLen(globalFeatures)
411-
ls.WriteWithLen(localFeatures)
393+
// For backwards compatibility reason, we must consider legacy `global features` section. (see bolt 1)
394+
let g: byte[] = [||]
395+
ls.WriteWithLen(g)
396+
ls.WriteWithLen(this.Features.ToByteArray())
412397
ls.WriteTLVStream(this.TLVStream |> Array.map(fun tlv -> tlv.ToGenericTLV()))
413398

414399
[<CLIMutable>]

tests/DotNetLightning.Core.Tests/DotNetLightning.Core.Tests.fsproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
<PackageReference Include="Expecto.FsCheck" Version="8.10.1" />
3737
<PackageReference Update="FSharp.Core" Version="4.7.0" />
3838
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.2.0" />
39-
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.*" />
4039
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.*" />
4140
</ItemGroup>
4241
<ItemGroup>

tests/DotNetLightning.Infrastructure.Tests/DotNetLightning.Infrastructure.Tests.fsproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
<PackageReference Update="FSharp.Core" Version="4.7.0" />
2525
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0" />
2626
<PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0" />
27-
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.*" />
2827
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.*" />
2928
</ItemGroup>
3029

0 commit comments

Comments
 (0)