Skip to content

Commit

Permalink
Fix protocol version fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
bezysoftware committed Oct 31, 2024
1 parent db21a1b commit 7cabcd8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Negentropy/Negentropy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public NegentropyReconciliation Reconcile(string query)
if (version != PROTOCOL_VERSION)
{
if (this.isInitiator) throw new InvalidOperationException("unsupported negentropy protocol version requested: " + (version - 0x60));
else writer.ToHexString();
else return new NegentropyReconciliation(writer.ToHexString(), [], []);
}

var prevBoundOut = Bound.Min;
Expand Down
10 changes: 10 additions & 0 deletions test/Negentropy.Tests/ReconcileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ public void LoadFromFileFrameSizeLimit()

//result = ne1.Reconcile(result.Query);
//result.Query.Should().Be(expectations[4]);

}

[Fact]
public void VersionFallbackTest()
{
var ne = new NegentropyBuilder(new NegentropyOptions()).Build();
var result = ne.Reconcile("62aabbccddeeff");

result.Query.Should().Be("61");
}
}
}

0 comments on commit 7cabcd8

Please sign in to comment.