Skip to content

Commit

Permalink
Seconds to milliseconds (#918)
Browse files Browse the repository at this point in the history
* Seconds to milliseconds

* Sending unsaved files

* fixing formula of consensus bonification

* Refactoring milliseconds

* Refactoring milliseconds from capeslock

* Refactoring milliseconds from capeslock II

* Adjusting UT

* Adjusting UT II

* Super fast protocol to 2s

* Fixing timestamps to long and tests

* Minor adjusts

* Change view deserialization fix

* Timestamp to ulong

* Update neo/Helper.cs

Co-Authored-By: Shargon <shargon@gmail.com>

* Update JNumber.cs

* Optimize and remove TODO

* Update ApplicationEngine.cs

* Fixing ExtendTimerByFactor 

This was already from milliseconds, thus, just removing the multiplier
  • Loading branch information
vncoelho committed Jul 22, 2019
1 parent 98e6d1c commit 00f9c27
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 101 deletions.
9 changes: 4 additions & 5 deletions neo.UnitTests/TestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public static Transaction GetTransaction()
};
}

public static void SetupHeaderWithValues(Header header, UInt256 val256, out UInt256 merkRootVal, out UInt160 val160, out uint timestampVal, out uint indexVal, out Witness scriptVal)
public static void SetupHeaderWithValues(Header header, UInt256 val256, out UInt256 merkRootVal, out UInt160 val160, out ulong timestampVal, out uint indexVal, out Witness scriptVal)
{
setupBlockBaseWithValues(header, val256, out merkRootVal, out val160, out timestampVal, out indexVal, out scriptVal);
}

public static void SetupBlockWithValues(Block block, UInt256 val256, out UInt256 merkRootVal, out UInt160 val160, out uint timestampVal, out uint indexVal, out Witness scriptVal, out Transaction[] transactionsVal, int numberOfTransactions)
public static void SetupBlockWithValues(Block block, UInt256 val256, out UInt256 merkRootVal, out UInt160 val160, out ulong timestampVal, out uint indexVal, out Witness scriptVal, out Transaction[] transactionsVal, int numberOfTransactions)
{
setupBlockBaseWithValues(block, val256, out merkRootVal, out val160, out timestampVal, out indexVal, out scriptVal);

Expand All @@ -58,13 +58,12 @@ public static void SetupBlockWithValues(Block block, UInt256 val256, out UInt256
block.Transactions = transactionsVal;
}

private static void setupBlockBaseWithValues(BlockBase bb, UInt256 val256, out UInt256 merkRootVal, out UInt160 val160, out uint timestampVal, out uint indexVal, out Witness scriptVal)
private static void setupBlockBaseWithValues(BlockBase bb, UInt256 val256, out UInt256 merkRootVal, out UInt160 val160, out ulong timestampVal, out uint indexVal, out Witness scriptVal)
{
bb.PrevHash = val256;
merkRootVal = UInt256.Parse("0xd841af3d6bd7adb4bca24306725f9aec363edb10de3cafc5f8cca948d7b0290f");

bb.MerkleRoot = merkRootVal;
timestampVal = new DateTime(1968, 06, 01, 0, 0, 0, DateTimeKind.Utc).ToTimestamp();
timestampVal = new DateTime(1980, 06, 01, 0, 0, 1, 001, DateTimeKind.Utc).ToTimestampMS(); // GMT: Sunday, June 1, 1980 12:00:01.001 AM
bb.Timestamp = timestampVal;
indexVal = 0;
bb.Index = indexVal;
Expand Down
31 changes: 17 additions & 14 deletions neo.UnitTests/UT_Block.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public void Size_Get()
{
UInt256 val256 = UInt256.Zero;
TestUtils.SetupBlockWithValues(uut, val256, out var _, out var _, out var _, out var _, out var _, out var _, 0);
// blockbase 4 + 32 + 32 + 4 + 4 + 20 + 4
// blockbase 4 + 64 + 32 + 4 + 4 + 20 + 4
// block 9 + 1
uut.Size.Should().Be(110);
uut.Size.Should().Be(114);
}

[TestMethod]
Expand All @@ -59,7 +59,7 @@ public void Size_Get_1_Transaction()
TestUtils.GetTransaction()
};

uut.Size.Should().Be(161);
uut.Size.Should().Be(165);
}

[TestMethod]
Expand All @@ -75,7 +75,7 @@ public void Size_Get_3_Transaction()
TestUtils.GetTransaction()
};

uut.Size.Should().Be(263);
uut.Size.Should().Be(267);
}

[TestMethod]
Expand All @@ -94,8 +94,7 @@ public void Serialize()
}
}

byte[] requiredData = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 41, 176, 215, 72, 169, 204, 248, 197, 175, 60, 222, 16, 219, 62, 54, 236, 154, 95, 114, 6, 67, 162, 188, 180, 173, 215, 107, 61, 175, 65, 216, 128, 171, 4, 253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 81, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0 };

byte[] requiredData = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 41, 176, 215, 72, 169, 204, 248, 197, 175, 60, 222, 16, 219, 62, 54, 236, 154, 95, 114, 6, 67, 162, 188, 180, 173, 215, 107, 61, 175, 65, 216, 233, 19, 255, 133, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 81, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0 };
data.Length.Should().Be(requiredData.Length);
for (int i = 0; i < data.Length; i++)
{
Expand All @@ -111,7 +110,8 @@ public void Deserialize()

uut.MerkleRoot = merkRoot; // need to set for deserialise to be valid

byte[] data = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 41, 176, 215, 72, 169, 204, 248, 197, 175, 60, 222, 16, 219, 62, 54, 236, 154, 95, 114, 6, 67, 162, 188, 180, 173, 215, 107, 61, 175, 65, 216, 128, 171, 4, 253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 81, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 };
byte[] data = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 41, 176, 215, 72, 169, 204, 248, 197, 175, 60, 222, 16, 219, 62, 54, 236, 154, 95, 114, 6, 67, 162, 188, 180, 173, 215, 107, 61, 175, 65, 216, 233, 19, 255, 133, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 81, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0 };

int index = 0;
using (MemoryStream ms = new MemoryStream(data, index, data.Length - index, false))
{
Expand All @@ -124,7 +124,7 @@ public void Deserialize()
assertStandardBlockTestVals(val256, merkRoot, val160, timestampVal, indexVal, scriptVal, transactionsVal);
}

private void assertStandardBlockTestVals(UInt256 val256, UInt256 merkRoot, UInt160 val160, uint timestampVal, uint indexVal, Witness scriptVal, Transaction[] transactionsVal, bool testTransactions = true)
private void assertStandardBlockTestVals(UInt256 val256, UInt256 merkRoot, UInt160 val160, ulong timestampVal, uint indexVal, Witness scriptVal, Transaction[] transactionsVal, bool testTransactions = true)
{
uut.PrevHash.Should().Be(val256);
uut.MerkleRoot.Should().Be(merkRoot);
Expand Down Expand Up @@ -155,7 +155,8 @@ public void Equals_DiffObj()
UInt256 prevHash = new UInt256(TestUtils.GetByteArray(32, 0x42));
UInt256 merkRoot;
UInt160 val160;
uint timestampVal, indexVal;
ulong timestampVal;
uint indexVal;
Witness scriptVal;
Transaction[] transactionsVal;
TestUtils.SetupBlockWithValues(newBlock, val256, out merkRoot, out val160, out timestampVal, out indexVal, out scriptVal, out transactionsVal, 1);
Expand All @@ -178,7 +179,8 @@ public void Equals_SameHash()
UInt256 prevHash = new UInt256(TestUtils.GetByteArray(32, 0x42));
UInt256 merkRoot;
UInt160 val160;
uint timestampVal, indexVal;
ulong timestampVal;
uint indexVal;
Witness scriptVal;
Transaction[] transactionsVal;
TestUtils.SetupBlockWithValues(newBlock, prevHash, out merkRoot, out val160, out timestampVal, out indexVal, out scriptVal, out transactionsVal, 1);
Expand All @@ -193,7 +195,8 @@ public void RebuildMerkleRoot_Updates()
UInt256 val256 = UInt256.Zero;
UInt256 merkRoot;
UInt160 val160;
uint timestampVal, indexVal;
ulong timestampVal;
uint indexVal;
Witness scriptVal;
Transaction[] transactionsVal;
TestUtils.SetupBlockWithValues(uut, val256, out merkRoot, out val160, out timestampVal, out indexVal, out scriptVal, out transactionsVal, 1);
Expand All @@ -214,12 +217,12 @@ public void ToJson()

JObject jObj = uut.ToJson();
jObj.Should().NotBeNull();
jObj["hash"].AsString().Should().Be("0x1d8642796276c8ce3c5c03b8984a1b593d99b49a63d830bb06f800b8c953be77");
jObj["size"].AsNumber().Should().Be(161);
jObj["hash"].AsString().Should().Be("0x4e1d8392e7c44830e7e45c18e5e0e3ef3c36af883868846d3691a436a62494b2");
jObj["size"].AsNumber().Should().Be(165);
jObj["version"].AsNumber().Should().Be(0);
jObj["previousblockhash"].AsString().Should().Be("0x0000000000000000000000000000000000000000000000000000000000000000");
jObj["merkleroot"].AsString().Should().Be("0xd841af3d6bd7adb4bca24306725f9aec363edb10de3cafc5f8cca948d7b0290f");
jObj["time"].AsNumber().Should().Be(4244941696);
jObj["time"].AsNumber().Should().Be(328665601001);
jObj["index"].AsNumber().Should().Be(0);
jObj["nextconsensus"].AsString().Should().Be("AFmseVrdL9f9oyCzZefL9tG6UbvhPbdYzM");

Expand Down
18 changes: 9 additions & 9 deletions neo.UnitTests/UT_Consensus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public void ConsensusService_Primary_Sends_PrepareRequest_After_OnStart()
int timeIndex = 0;
var timeValues = new[] {
//new DateTime(1968, 06, 01, 0, 0, 15, DateTimeKind.Utc), // For tests here
new DateTime(1968, 06, 01, 0, 0, 1, DateTimeKind.Utc), // For receiving block
new DateTime(1968, 06, 01, 0, 0, (int) Blockchain.SecondsPerBlock, DateTimeKind.Utc), // For Initialize
new DateTime(1968, 06, 01, 0, 0, 15, DateTimeKind.Utc), // unused
new DateTime(1968, 06, 01, 0, 0, 15, DateTimeKind.Utc) // unused
new DateTime(1980, 06, 01, 0, 0, 1, 001, DateTimeKind.Utc), // For receiving block
new DateTime(1980, 06, 01, 0, 0, (int) Blockchain.MillisecondsPerBlock / 1000, 100, DateTimeKind.Utc), // For Initialize
new DateTime(1980, 06, 01, 0, 0, 15, 001, DateTimeKind.Utc), // unused
new DateTime(1980, 06, 01, 0, 0, 15, 001, DateTimeKind.Utc) // unused
};
//TimeProvider.Current.UtcNow.ToTimestamp().Should().Be(4244941711); //1968-06-01 00:00:15

Expand All @@ -74,12 +74,12 @@ public void ConsensusService_Primary_Sends_PrepareRequest_After_OnStart()

// Creating proposed block
Header header = new Header();
TestUtils.SetupHeaderWithValues(header, UInt256.Zero, out UInt256 merkRootVal, out UInt160 val160, out uint timestampVal, out uint indexVal, out Witness scriptVal);
header.Size.Should().Be(101);
TestUtils.SetupHeaderWithValues(header, UInt256.Zero, out UInt256 merkRootVal, out UInt160 val160, out ulong timestampVal, out uint indexVal, out Witness scriptVal);
header.Size.Should().Be(105);

Console.WriteLine($"header {header} hash {header.Hash} timstamp {timestampVal}");
Console.WriteLine($"header {header} hash {header.Hash} timestamp {timestampVal}");

timestampVal.Should().Be(4244941696); //1968-06-01 00:00:00
timestampVal.Should().Be(328665601001); // GMT: Sunday, June 1, 1980 12:00:01.001 AM
// check basic ConsensusContext
//mockConsensusContext.Object.block_received_time.ToTimestamp().Should().Be(4244941697); //1968-06-01 00:00:01

Expand Down Expand Up @@ -197,7 +197,7 @@ public void TestSerializeAndDeserializeConsensusContext()
consensusContext.CommitPayloads[6] = MakeSignedPayload(consensusContext, new Commit { Signature = sha256.ComputeHash(testTx2.Hash.ToArray()) }, 3, new[] { (byte)'6', (byte)'7' });
}

consensusContext.Block.Timestamp = TimeProvider.Current.UtcNow.ToTimestamp();
consensusContext.Block.Timestamp = TimeProvider.Current.UtcNow.ToTimestampMS();

consensusContext.ChangeViewPayloads = new ConsensusPayload[consensusContext.Validators.Length];
consensusContext.ChangeViewPayloads[0] = MakeSignedPayload(consensusContext, new ChangeView { ViewNumber = 1, Timestamp = 6 }, 0, new[] { (byte)'A' });
Expand Down
16 changes: 9 additions & 7 deletions neo.UnitTests/UT_Header.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,23 @@ public void Size_Get()
{
UInt256 val256 = UInt256.Zero;
TestUtils.SetupHeaderWithValues(uut, val256, out _, out _, out _, out _, out _);
// blockbase 4 + 32 + 32 + 4 + 4 + 20 + 4
// blockbase 4 + 64 + 32 + 4 + 4 + 20 + 4
// header 1
uut.Size.Should().Be(101);
uut.Size.Should().Be(105);
}

[TestMethod]
public void Deserialize()
{
UInt256 val256 = UInt256.Zero;
TestUtils.SetupHeaderWithValues(new Header(), val256, out UInt256 merkRoot, out UInt160 val160, out uint timestampVal, out uint indexVal, out Witness scriptVal);
TestUtils.SetupHeaderWithValues(new Header(), val256, out UInt256 merkRoot, out UInt160 val160, out ulong timestampVal, out uint indexVal, out Witness scriptVal);

uut.MerkleRoot = merkRoot; // need to set for deserialise to be valid

byte[] data = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 41, 176, 215, 72, 169, 204, 248, 197, 175, 60, 222, 16, 219, 62, 54, 236, 154, 95, 114, 6, 67, 162, 188, 180, 173, 215, 107, 61, 175, 65, 216, 128, 171, 4, 253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 81, 0 };
byte[] requiredData = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 41, 176, 215, 72, 169, 204, 248, 197, 175, 60, 222, 16, 219, 62, 54, 236, 154, 95, 114, 6, 67, 162, 188, 180, 173, 215, 107, 61, 175, 65, 216, 233, 19, 255, 133, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 81, 0 };

int index = 0;
using (MemoryStream ms = new MemoryStream(data, index, data.Length - index, false))
using (MemoryStream ms = new MemoryStream(requiredData, index, requiredData.Length - index, false))
{
using (BinaryReader reader = new BinaryReader(ms))
{
Expand All @@ -48,7 +49,7 @@ public void Deserialize()
assertStandardHeaderTestVals(val256, merkRoot, val160, timestampVal, indexVal, scriptVal);
}

private void assertStandardHeaderTestVals(UInt256 val256, UInt256 merkRoot, UInt160 val160, uint timestampVal, uint indexVal, Witness scriptVal)
private void assertStandardHeaderTestVals(UInt256 val256, UInt256 merkRoot, UInt160 val160, ulong timestampVal, uint indexVal, Witness scriptVal)
{
uut.PrevHash.Should().Be(val256);
uut.MerkleRoot.Should().Be(merkRoot);
Expand Down Expand Up @@ -106,9 +107,10 @@ public void Serialize()
}
}

byte[] requiredData = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 41, 176, 215, 72, 169, 204, 248, 197, 175, 60, 222, 16, 219, 62, 54, 236, 154, 95, 114, 6, 67, 162, 188, 180, 173, 215, 107, 61, 175, 65, 216, 128, 171, 4, 253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 81, 0 };
byte[] requiredData = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 41, 176, 215, 72, 169, 204, 248, 197, 175, 60, 222, 16, 219, 62, 54, 236, 154, 95, 114, 6, 67, 162, 188, 180, 173, 215, 107, 61, 175, 65, 216, 233, 19, 255, 133, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 81, 0 };

data.Length.Should().Be(requiredData.Length);

for (int i = 0; i < data.Length; i++)
{
data[i].Should().Be(requiredData[i]);
Expand Down
2 changes: 1 addition & 1 deletion neo.UnitTests/protocol.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ProtocolConfiguration": {
"SecondsPerBlock": 2
"MillisecondsPerBlock": 2000
}
}
6 changes: 3 additions & 3 deletions neo/Consensus/ChangeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ public class ChangeView : ConsensusMessage
/// they only respond once to a specific ChangeView request (it thus prevents replay of the ChangeView
/// message from repeatedly broadcasting RecoveryMessages).
/// </summary>
public uint Timestamp;
public ulong Timestamp;

/// <summary>
/// Reason
/// </summary>
public ChangeViewReason Reason;

public override int Size => base.Size +
sizeof(uint) + // Timestamp
sizeof(ulong) + // Timestamp
sizeof(ChangeViewReason); // Reason

public ChangeView() : base(ConsensusMessageType.ChangeView) { }

public override void Deserialize(BinaryReader reader)
{
base.Deserialize(reader);
Timestamp = reader.ReadUInt32();
Timestamp = reader.ReadUInt64();
Reason = (ChangeViewReason)reader.ReadByte();
}

Expand Down
8 changes: 4 additions & 4 deletions neo/Consensus/ConsensusContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void Deserialize(BinaryReader reader)
Reset(0);
if (reader.ReadUInt32() != Block.Version) throw new FormatException();
if (reader.ReadUInt32() != Block.Index) throw new InvalidOperationException();
Block.Timestamp = reader.ReadUInt32();
Block.Timestamp = reader.ReadUInt64();
Block.NextConsensus = reader.ReadSerializable<UInt160>();
if (Block.NextConsensus.Equals(UInt160.Zero))
Block.NextConsensus = null;
Expand Down Expand Up @@ -164,7 +164,7 @@ public ConsensusPayload MakeChangeView(ChangeViewReason reason)
return ChangeViewPayloads[MyIndex] = MakeSignedPayload(new ChangeView
{
Reason = reason,
Timestamp = TimeProvider.Current.UtcNow.ToTimestamp()
Timestamp = TimeProvider.Current.UtcNow.ToTimestampMS()
});
}

Expand Down Expand Up @@ -216,7 +216,7 @@ public ConsensusPayload MakePrepareRequest()
List<Transaction> transactions = memoryPoolTransactions.ToList();
TransactionHashes = transactions.Select(p => p.Hash).ToArray();
Transactions = transactions.ToDictionary(p => p.Hash);
Block.Timestamp = Math.Max(TimeProvider.Current.UtcNow.ToTimestamp(), PrevHeader.Timestamp + 1);
Block.Timestamp = Math.Max(TimeProvider.Current.UtcNow.ToTimestampMS(), PrevHeader.Timestamp + 1);
Block.ConsensusData.Nonce = BitConverter.ToUInt64(buffer, 0);
return PreparationPayloads[MyIndex] = MakeSignedPayload(new PrepareRequest
{
Expand All @@ -230,7 +230,7 @@ public ConsensusPayload MakeRecoveryRequest()
{
return MakeSignedPayload(new RecoveryRequest
{
Timestamp = TimeProvider.Current.UtcNow.ToTimestamp()
Timestamp = TimeProvider.Current.UtcNow.ToTimestampMS()
});
}

Expand Down
Loading

0 comments on commit 00f9c27

Please sign in to comment.