Skip to content

Commit

Permalink
Merge pull request #418 from NethermindEth/streamRlp
Browse files Browse the repository at this point in the history
Stream rlp
  • Loading branch information
tkstanczak authored Mar 17, 2019
2 parents fd0e0d4 + 91255d8 commit d7621b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Nethermind/Ethereum.PoW.Test/EthashTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void Test(EthashTest test)
Assert.AreEqual(test.Nonce, blockHeader.Nonce, "header nonce vs test nonce");
Assert.AreEqual(test.MixHash.Bytes, blockHeader.MixHash.Bytes, "header mix hash vs test mix hash");

Keccak headerHash = Keccak.Compute(Rlp.Encode(blockHeader, RlpBehaviors.ExcludeBlockMixHashAndNonce));
Keccak headerHash = Keccak.Compute(Rlp.Encode(blockHeader, RlpBehaviors.ForSealing));
Assert.AreEqual(test.HeaderHash, headerHash, "header hash");

// seed is correct
Expand Down
5 changes: 3 additions & 2 deletions src/Nethermind/Nethermind.Db/SimpleFilePublicKeyDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

namespace Nethermind.Db
{
// TODO: replace or optimize
public class SimpleFilePublicKeyDb : IFullDb
{
private readonly ILogger _logger;
Expand Down Expand Up @@ -92,13 +93,13 @@ public void CommitBatch()
{
foreach (var keyValuePair in snapshot)
{
streamWriter.WriteLine($"{keyValuePair.Key},{keyValuePair.Value.ToHexString()}");
streamWriter.Write(string.Concat(keyValuePair.Key, ",", keyValuePair.Value.ToHexString()));
}
}

RemoveBackup(tempFilePath);

_perfService.EndPerfCalc(key, $"Db commit ({_dbLastDirName}), items count: {snapshot.Length}");
_perfService.EndPerfCalc(key);
}

private void RemoveBackup(string tempFilePath)
Expand Down

0 comments on commit d7621b6

Please sign in to comment.