@@ -269,8 +269,8 @@ public bool IsBlocked(IReadOnlyStore snapshot, UInt160 account)
269269 public void SetMillisecondsPerBlock ( ApplicationEngine engine , uint value )
270270 {
271271 if ( value == 0 || value > MaxMillisecondsPerBlock )
272- throw new ArgumentOutOfRangeException ( nameof ( value ) , $ "MillisecondsPerBlock must be between 1 and { MaxMillisecondsPerBlock } , got { value } ") ;
273- if ( ! CheckCommittee ( engine ) ) throw new InvalidOperationException ( "Invalid committee signature" ) ;
272+ throw new ArgumentOutOfRangeException ( nameof ( value ) , $ "MillisecondsPerBlock must be between [1, { MaxMillisecondsPerBlock } ] , got { value } ") ;
273+ AssertCommittee ( engine ) ;
274274
275275 var oldTime = GetMillisecondsPerBlock ( engine . SnapshotCache ) ;
276276 engine . SnapshotCache . GetAndChange ( _millisecondsPerBlock ) . Set ( value ) ;
@@ -325,7 +325,7 @@ private void SetAttributeFee(ApplicationEngine engine, byte attributeType, uint
325325 if ( value > MaxAttributeFee )
326326 throw new ArgumentOutOfRangeException ( nameof ( value ) , $ "AttributeFee must be less than { MaxAttributeFee } ") ;
327327
328- if ( ! CheckCommittee ( engine ) ) throw new InvalidOperationException ( ) ;
328+ AssertCommittee ( engine ) ;
329329
330330 engine . SnapshotCache . GetAndChange ( CreateStorageKey ( Prefix_AttributeFee , attributeType ) , ( ) => new StorageItem ( DefaultAttributeFee ) ) . Set ( value ) ;
331331 }
@@ -335,7 +335,8 @@ private void SetFeePerByte(ApplicationEngine engine, long value)
335335 {
336336 if ( value < 0 || value > 1_00000000 )
337337 throw new ArgumentOutOfRangeException ( nameof ( value ) , $ "FeePerByte must be between [0, 100000000], got { value } ") ;
338- if ( ! CheckCommittee ( engine ) ) throw new InvalidOperationException ( ) ;
338+ AssertCommittee ( engine ) ;
339+
339340 engine . SnapshotCache . GetAndChange ( _feePerByte ) . Set ( value ) ;
340341 }
341342
@@ -344,7 +345,8 @@ private void SetExecFeeFactor(ApplicationEngine engine, uint value)
344345 {
345346 if ( value == 0 || value > MaxExecFeeFactor )
346347 throw new ArgumentOutOfRangeException ( nameof ( value ) , $ "ExecFeeFactor must be between [1, { MaxExecFeeFactor } ], got { value } ") ;
347- if ( ! CheckCommittee ( engine ) ) throw new InvalidOperationException ( ) ;
348+ AssertCommittee ( engine ) ;
349+
348350 engine . SnapshotCache . GetAndChange ( _execFeeFactor ) . Set ( value ) ;
349351 }
350352
@@ -353,7 +355,8 @@ private void SetStoragePrice(ApplicationEngine engine, uint value)
353355 {
354356 if ( value == 0 || value > MaxStoragePrice )
355357 throw new ArgumentOutOfRangeException ( nameof ( value ) , $ "StoragePrice must be between [1, { MaxStoragePrice } ], got { value } ") ;
356- if ( ! CheckCommittee ( engine ) ) throw new InvalidOperationException ( ) ;
358+ AssertCommittee ( engine ) ;
359+
357360 engine . SnapshotCache . GetAndChange ( _storagePrice ) . Set ( value ) ;
358361 }
359362
@@ -365,7 +368,8 @@ private void SetMaxValidUntilBlockIncrement(ApplicationEngine engine, uint value
365368 var mtb = GetMaxTraceableBlocks ( engine . SnapshotCache ) ;
366369 if ( value >= mtb )
367370 throw new InvalidOperationException ( $ "MaxValidUntilBlockIncrement must be lower than MaxTraceableBlocks ({ value } vs { mtb } )") ;
368- if ( ! CheckCommittee ( engine ) ) throw new InvalidOperationException ( ) ;
371+ AssertCommittee ( engine ) ;
372+
369373 engine . SnapshotCache . GetAndChange ( _maxValidUntilBlockIncrement ) . Set ( value ) ;
370374 }
371375
@@ -379,26 +383,31 @@ private void SetMaxTraceableBlocks(ApplicationEngine engine, uint value)
379383 {
380384 if ( value == 0 || value > MaxMaxTraceableBlocks )
381385 throw new ArgumentOutOfRangeException ( nameof ( value ) , $ "MaxTraceableBlocks must be between [1, { MaxMaxTraceableBlocks } ], got { value } ") ;
386+
382387 var oldVal = GetMaxTraceableBlocks ( engine . SnapshotCache ) ;
383388 if ( value > oldVal )
384389 throw new InvalidOperationException ( $ "MaxTraceableBlocks can not be increased (old { oldVal } , new { value } )") ;
390+
385391 var mVUBIncrement = GetMaxValidUntilBlockIncrement ( engine . SnapshotCache ) ;
386392 if ( value <= mVUBIncrement )
387393 throw new InvalidOperationException ( $ "MaxTraceableBlocks must be larger than MaxValidUntilBlockIncrement ({ value } vs { mVUBIncrement } )") ;
388- if ( ! CheckCommittee ( engine ) ) throw new InvalidOperationException ( "Invalid committee signature" ) ;
394+
395+ AssertCommittee ( engine ) ;
396+
389397 engine . SnapshotCache . GetAndChange ( _maxTraceableBlocks ) . Set ( value ) ;
390398 }
391399
392400 [ ContractMethod ( CpuFee = 1 << 15 , RequiredCallFlags = CallFlags . States ) ]
393401 private bool BlockAccount ( ApplicationEngine engine , UInt160 account )
394402 {
395- if ( ! CheckCommittee ( engine ) ) throw new InvalidOperationException ( ) ;
403+ AssertCommittee ( engine ) ;
404+
396405 return BlockAccount ( engine . SnapshotCache , account ) ;
397406 }
398407
399408 internal bool BlockAccount ( DataCache snapshot , UInt160 account )
400409 {
401- if ( IsNative ( account ) ) throw new InvalidOperationException ( "It's impossible to block a native contract." ) ;
410+ if ( IsNative ( account ) ) throw new InvalidOperationException ( "Cannot block a native contract." ) ;
402411
403412 var key = CreateStorageKey ( Prefix_BlockedAccount , account ) ;
404413 if ( snapshot . Contains ( key ) ) return false ;
@@ -410,7 +419,8 @@ internal bool BlockAccount(DataCache snapshot, UInt160 account)
410419 [ ContractMethod ( CpuFee = 1 << 15 , RequiredCallFlags = CallFlags . States ) ]
411420 private bool UnblockAccount ( ApplicationEngine engine , UInt160 account )
412421 {
413- if ( ! CheckCommittee ( engine ) ) throw new InvalidOperationException ( ) ;
422+ AssertCommittee ( engine ) ;
423+
414424
415425 var key = CreateStorageKey ( Prefix_BlockedAccount , account ) ;
416426 if ( ! engine . SnapshotCache . Contains ( key ) ) return false ;
0 commit comments