@@ -194,17 +194,23 @@ export class Proxy {
194194 return channel_genesis_hash ;
195195 }
196196
197- getLatestBlockTime ( channel , currentTime ) {
198- let curBlockTime : any ;
197+ /**
198+ *
199+ *
200+ * @param {* } channel
201+ * @returns
202+ * @memberof Proxy
203+ */
204+
205+ getLatestBlockTime ( channel ) {
206+ let latestBlockEntry : Date ;
199207 let agoTime = '' ;
200208 if ( ! channel ?. latestdate ) return agoTime ;
201- curBlockTime = channel . latestdate ;
202- const dateCurBlock = new Date ( curBlockTime ) ;
203- const dateCur = new Date ( currentTime . to ) ;
204- const timeCurBlock = dateCurBlock . getTime ( ) ;
205- const timeCur = dateCur . getTime ( ) ;
206- const curBlockTimeDiff = timeCur - timeCurBlock ;
207- const seconds = Math . floor ( curBlockTimeDiff / 1000 ) ;
209+ latestBlockEntry = channel . latestdate ;
210+ const latestBlockEntryTime = latestBlockEntry . getTime ( ) ;
211+ const currentBlockDate = Date . now ( ) ;
212+ const agoBlockTimeDiff = currentBlockDate - latestBlockEntryTime ;
213+ const seconds = Math . floor ( agoBlockTimeDiff / 1000 ) ;
208214 const minutes = Math . floor ( seconds / 60 ) ;
209215 const hours = Math . floor ( minutes / 60 ) ;
210216 const days = Math . floor ( hours / 24 ) ;
@@ -227,14 +233,13 @@ export class Proxy {
227233 */
228234 async getChannelsInfo ( network_id ) {
229235 const client = this . platform . getClient ( network_id ) ;
230- const {
231- channels,
232- currentTime
233- } = await this . persistence . getCrudService ( ) . getChannelsInfo ( network_id ) ;
236+ const channels = await this . persistence
237+ . getCrudService ( )
238+ . getChannelsInfo ( network_id ) ;
234239 const currentchannels = [ ] ;
235240 for ( const channel of channels ) {
236241 const channel_genesis_hash = client . getChannelGenHash ( channel . channelname ) ;
237- let agoBlockTime = this . getLatestBlockTime ( channel , currentTime ) ;
242+ let agoBlockTime = this . getLatestBlockTime ( channel ) ;
238243 if (
239244 channel_genesis_hash &&
240245 channel_genesis_hash === channel . channel_genesis_hash
0 commit comments