Skip to content

Commit

Permalink
Use big-endian for better compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Groxan committed Sep 8, 2020
1 parent 12b06ff commit 2ade845
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Tzkt.Data/Models/Accounts/Delegate.cs
Expand Up @@ -25,7 +25,7 @@ public class Delegate : User
public int NonceRevelationsCount { get; set; }
public int RevelationPenaltiesCount { get; set; }

public int Version { get; set; }
public uint Version { get; set; }

#region indirect relations
public List<Account> DelegatedAccounts { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Data/Models/Blocks/Block.cs
Expand Up @@ -12,7 +12,7 @@ public class Block
public string Hash { get; set; }
public DateTime Timestamp { get; set; }
public int ProtoCode { get; set; }
public int Version { get; set; }
public uint Version { get; set; }

public int Priority { get; set; }
public int Validations { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Sync/Protocols/Handlers/Proto3/Commits/BlockCommit.cs
Expand Up @@ -52,7 +52,7 @@ public async Task Init(RawBlock rawBlock)
Baker = Cache.Accounts.GetDelegate(rawBlock.Metadata.Baker),
Events = events,
Reward = protocol.BlockReward0,
Version = BitConverter.ToInt32(Hex.Parse(rawBlock.Header.PowNonce.Substring(0, 8)))
Version = BitConverter.ToUInt32(Hex.Parse(rawBlock.Header.PowNonce.Substring(0, 8)).Reverse())
};
}

Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Sync/Protocols/Handlers/Proto4/Commits/BlockCommit.cs
Expand Up @@ -52,7 +52,7 @@ public async Task Init(RawBlock rawBlock)
Baker = Cache.Accounts.GetDelegate(rawBlock.Metadata.Baker),
Events = events,
Reward = protocol.BlockReward0,
Version = BitConverter.ToInt32(Hex.Parse(rawBlock.Header.PowNonce.Substring(0, 8)))
Version = BitConverter.ToUInt32(Hex.Parse(rawBlock.Header.PowNonce.Substring(0, 8)).Reverse())
};
}

Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Sync/Protocols/Handlers/Proto5/Commits/BlockCommit.cs
Expand Up @@ -53,7 +53,7 @@ public async Task Init(RawBlock rawBlock)
Baker = Cache.Accounts.GetDelegate(rawBlock.Metadata.Baker),
Events = events,
Reward = protocol.BlockReward0 * (8 + 2 * validations / protocol.EndorsersPerBlock) / 10 / (rawBlock.Header.Priority + 1),
Version = BitConverter.ToInt32(Hex.Parse(rawBlock.Header.PowNonce.Substring(0, 8)))
Version = BitConverter.ToUInt32(Hex.Parse(rawBlock.Header.PowNonce.Substring(0, 8)).Reverse())
};
}

Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Sync/Protocols/Handlers/Proto6/Commits/BlockCommit.cs
Expand Up @@ -53,7 +53,7 @@ public async Task Init(RawBlock rawBlock)
Baker = Cache.Accounts.GetDelegate(rawBlock.Metadata.Baker),
Events = events,
Reward = (rawBlock.Header.Priority == 0 ? protocol.BlockReward0 : protocol.BlockReward1) * validations,
Version = BitConverter.ToInt32(Hex.Parse(rawBlock.Header.PowNonce.Substring(0, 8)))
Version = BitConverter.ToUInt32(Hex.Parse(rawBlock.Header.PowNonce.Substring(0, 8)).Reverse())
};
}

Expand Down

0 comments on commit 2ade845

Please sign in to comment.