@@ -99,7 +99,7 @@ public void OnShowTransactionCommand(UInt256 hash)
9999 return ;
100100 }
101101
102- var block = NativeContract . Ledger . GetHeader ( NeoSystem . StoreView , tx . BlockIndex ) ;
102+ var block = NativeContract . Ledger . GetHeader ( NeoSystem . StoreView , tx . BlockIndex ) ! ;
103103
104104 var transactionDatetime = new DateTime ( 1970 , 1 , 1 , 0 , 0 , 0 , 0 , DateTimeKind . Utc ) ;
105105 transactionDatetime = transactionDatetime . AddMilliseconds ( block . Timestamp ) . ToLocalTime ( ) ;
@@ -126,20 +126,20 @@ public void OnShowTransactionCommand(UInt256 hash)
126126
127127 foreach ( var signer in tx . Transaction . Signers )
128128 {
129- if ( signer . Rules . Length == 0 )
130- ConsoleHelper . Info ( "" , " Rules: " , "[]" ) ;
131- else
129+ if ( signer . Rules ? . Length > 0 )
132130 ConsoleHelper . Info ( "" , " Rules: " , $ "[{ string . Join ( ", " , signer . Rules . Select ( s => $ "\" { s . ToJson ( ) } \" ") ) } ]") ;
131+ else
132+ ConsoleHelper . Info ( "" , " Rules: " , "[]" ) ;
133133 ConsoleHelper . Info ( "" , " Account: " , $ "{ signer . Account } ") ;
134134 ConsoleHelper . Info ( "" , " Scopes: " , $ "{ signer . Scopes } ") ;
135- if ( signer . AllowedContracts . Length == 0 )
136- ConsoleHelper . Info ( "" , " AllowedContracts: " , "[]" ) ;
137- else
135+ if ( signer . AllowedContracts ? . Length > 0 )
138136 ConsoleHelper . Info ( "" , " AllowedContracts: " , $ "[{ string . Join ( ", " , signer . AllowedContracts . Select ( s => s . ToString ( ) ) ) } ]") ;
139- if ( signer . AllowedGroups . Length == 0 )
140- ConsoleHelper . Info ( "" , " AllowedGroups: " , "[]" ) ;
141137 else
138+ ConsoleHelper . Info ( "" , " AllowedContracts: " , "[]" ) ;
139+ if ( signer . AllowedGroups ? . Length > 0 )
142140 ConsoleHelper . Info ( "" , " AllowedGroups: " , $ "[{ string . Join ( ", " , signer . AllowedGroups . Select ( s => s . ToString ( ) ) ) } ]") ;
141+ else
142+ ConsoleHelper . Info ( "" , " AllowedGroups: " , "[]" ) ;
143143 ConsoleHelper . Info ( "" , " Size: " , $ "{ signer . Size } Byte(s)") ;
144144 ConsoleHelper . Info ( ) ;
145145 }
@@ -209,15 +209,17 @@ public void OnShowContractCommand(string nameOrHash)
209209 {
210210 ContractState ? contract = null ;
211211 NativeContract ? nativeContract = null ;
212- var isHash = UInt160 . TryParse ( nameOrHash , out var scriptHash ) ;
213- if ( isHash )
212+ bool isHash ;
213+ if ( UInt160 . TryParse ( nameOrHash , out var scriptHash ) )
214214 {
215+ isHash = true ;
215216 contract = NativeContract . ContractManagement . GetContract ( NeoSystem . StoreView , scriptHash ) ;
216217 if ( contract is null )
217218 nativeContract = NativeContract . Contracts . SingleOrDefault ( s => s . Hash == scriptHash ) ;
218219 }
219220 else
220221 {
222+ isHash = false ;
221223 nativeContract = NativeContract . Contracts . SingleOrDefault ( s => s . Name . Equals ( nameOrHash , StringComparison . InvariantCultureIgnoreCase ) ) ;
222224 if ( nativeContract != null )
223225 contract = NativeContract . ContractManagement . GetContract ( NeoSystem . StoreView , nativeContract . Hash ) ;
0 commit comments