1
#nullable enable
2
using Bencodex;
3
using Bencodex.Types;
4

5
namespace Libplanet.Store.Trie.Nodes
6
{
7
    internal abstract class BaseNode : INode
8
    {
9
        private static Codec _codec;
10

11
        static BaseNode()
12 1
        {
13 1
            _codec = new Codec();
14 1
        }
15

16 1
        public BaseNode(INode? value)
17 1
        {
18 1
            Value = value;
19 1
        }
20

21
        // It will not support embedded node.
22 1
        public INode? Value { get; }
23

24 1
        public byte[] Serialize() => _codec.Encode(ToBencodex());
25

26
        public abstract IValue ToBencodex();
27
    }
28
}

Read our documentation on viewing source code .

Loading