示例#1
0
        private bool SetFeePerByte(ApplicationEngine engine, long value)
        {
            if (!CheckCommittee(engine))
            {
                return(false);
            }
            StorageItem storage = engine.Snapshot.Storages.GetAndChange(CreateStorageKey(Prefix_FeePerByte), () => new StorageItem());

            storage.Set(value);
            return(true);
        }
示例#2
0
        private bool SetMaxTransactionsPerBlock(ApplicationEngine engine, uint value)
        {
            if (!CheckCommittee(engine))
            {
                return(false);
            }
            StorageItem storage = engine.Snapshot.Storages.GetAndChange(CreateStorageKey(Prefix_MaxTransactionsPerBlock), () => new StorageItem());

            storage.Set(value);
            return(true);
        }
示例#3
0
        private bool SetStoragePrice(ApplicationEngine engine, uint value)
        {
            if (value == 0 || value > MaxStoragePrice)
            {
                throw new ArgumentOutOfRangeException(nameof(value));
            }
            if (!CheckCommittee(engine))
            {
                return(false);
            }
            StorageItem storage = engine.Snapshot.Storages.GetAndChange(CreateStorageKey(Prefix_StoragePrice), () => new StorageItem());

            storage.Set(value);
            return(true);
        }
示例#4
0
        private bool SetFeePerByte(ApplicationEngine engine, long value)
        {
            if (value < 0 || value > 1_00000000)
            {
                throw new ArgumentOutOfRangeException(nameof(value));
            }
            if (!CheckCommittee(engine))
            {
                return(false);
            }
            StorageItem storage = engine.Snapshot.Storages.GetAndChange(CreateStorageKey(Prefix_FeePerByte), () => new StorageItem());

            storage.Set(value);
            return(true);
        }
示例#5
0
        private bool SetMaxBlockSystemFee(ApplicationEngine engine, long value)
        {
            if (!CheckCommittee(engine))
            {
                return(false);
            }
            if (value <= 4007600)
            {
                return(false);
            }
            StorageItem storage = engine.Snapshot.Storages.GetAndChange(CreateStorageKey(Prefix_MaxBlockSystemFee), () => new StorageItem());

            storage.Set(value);
            return(true);
        }
示例#6
0
        private bool SetMaxBlockSize(ApplicationEngine engine, uint value)
        {
            if (!CheckCommittee(engine))
            {
                return(false);
            }
            if (Network.P2P.Message.PayloadMaxSize <= value)
            {
                return(false);
            }
            StorageItem storage = engine.Snapshot.Storages.GetAndChange(CreateStorageKey(Prefix_MaxBlockSize), () => new StorageItem());

            storage.Set(value);
            return(true);
        }
示例#7
0
        private bool SetMaxTransactionsPerBlock(ApplicationEngine engine, uint value)
        {
            if (value > Block.MaxTransactionsPerBlock)
            {
                throw new ArgumentOutOfRangeException(nameof(value));
            }
            if (!CheckCommittee(engine))
            {
                return(false);
            }
            StorageItem storage = engine.Snapshot.GetAndChange(CreateStorageKey(Prefix_MaxTransactionsPerBlock), () => new StorageItem());

            storage.Set(value);
            return(true);
        }
示例#8
0
        private void SetGasPerBlock(ApplicationEngine engine, BigInteger gasPerBlock)
        {
            if (gasPerBlock < 0 || gasPerBlock > 10 * GAS.Factor)
            {
                throw new ArgumentOutOfRangeException(nameof(gasPerBlock));
            }
            if (!CheckCommittee(engine))
            {
                throw new InvalidOperationException();
            }

            uint        index = engine.PersistingBlock.Index + 1;
            StorageItem entry = engine.Snapshot.GetAndChange(CreateStorageKey(Prefix_GasPerBlock).AddBigEndian(index), () => new StorageItem(gasPerBlock));

            entry.Set(gasPerBlock);
        }