예제 #1
0
        public bool ApplyGenesis(Block mcblk)
        {
            Log.Debug("ApplyGenesis");

            using (DbSnapshot dbSnapshot = levelDBStore.GetSnapshotUndo(1))
            {
                Block linkblk = mcblk;
                for (int jj = 0; jj < linkblk.linkstran.Count; jj++)
                {
                    if (!ApplyTransfer(dbSnapshot, linkblk.linkstran[jj], linkblk.height))
                    {
                        return(false);
                    }
                    if (!ApplyContract(dbSnapshot, linkblk.linkstran[jj], linkblk.height))
                    {
                        return(false);
                    }
                }
                new BlockChain()
                {
                    hash = mcblk.hash, height = mcblk.height
                }.Apply(dbSnapshot);

                dbSnapshot.Commit();
            }
            return(true);
        }