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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }