Пример #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);
        }