예제 #1
0
        public void Store(IDb db)
        {
            SnapshotDecoder decoder = new SnapshotDecoder();
            Rlp             rlp     = decoder.Encode(this);

            byte[] blob = rlp.Bytes;
            Keccak key  = GetSnapshotKey(Hash);

            db.Set(key, blob);
        }
예제 #2
0
        public static Snapshot LoadSnapshot(LruCache <Keccak, Address> sigCache, IDb db, Keccak hash)
        {
            Keccak key = GetSnapshotKey(hash);

            byte[] blob = db.Get(key);
            if (blob == null)
            {
                return(null);
            }

            SnapshotDecoder decoder  = new SnapshotDecoder();
            Snapshot        snapshot = decoder.Decode(blob.AsRlpContext());

            snapshot.SigCache = sigCache;
            return(snapshot);
        }