/
InvalidGenesisBlockException.cs
48 lines (45 loc) · 1.69 KB
/
InvalidGenesisBlockException.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#nullable enable
using System.Diagnostics.Contracts;
using Libplanet.Blockchain;
using Libplanet.Store;
namespace Libplanet.Blocks
{
/// <summary>
/// The exception that is thrown when the genesis block the <see cref="IStore"/> contains
/// mismatches to the genesis block the <see cref="BlockChain{T}"/> constructor (i.e., network)
/// expects or the first block of <see cref="BlockLocator"/> which the <see cref="IStore"/>
/// doesn't contain, because the block which <see cref="IStore"/> doesn't means
/// the genesis block in other network.
/// </summary>
public class InvalidGenesisBlockException : InvalidBlockException
{
/// <summary>
/// Initializes a new instance of the
/// <see cref="InvalidGenesisBlockException"/> class.
/// </summary>
/// <param name="networkExpected">The genesis block that the network expects.</param>
/// <param name="stored">The genesis block that a local <see cref="IStore"/> contains.
/// </param>
/// <param name="message">The message that describes the error.</param>
public InvalidGenesisBlockException(
BlockHash networkExpected,
BlockHash stored,
string message
)
: base(message)
{
NetworkExpected = networkExpected;
Stored = stored;
}
/// <summary>
/// The genesis block that the network expects.
/// </summary>
[Pure]
public BlockHash NetworkExpected { get; }
/// <summary>
/// The genesis block that a local <see cref="IStore"/> contains.
/// </summary>
[Pure]
public BlockHash Stored { get; }
}
}