@@ -1059,7 +1059,7 @@ class Shardus extends EventEmitter {
1059
1059
}
1060
1060
}
1061
1061
1062
- async _timestampAndQueueTransaction ( tx : ShardusTypes . OpaqueTransaction , appData : any , global = false , noConsensus = false ) {
1062
+ async _timestampAndQueueTransaction ( tx : ShardusTypes . OpaqueTransaction , appData : any , global = false , noConsensus = false , loggingContext = '' ) {
1063
1063
// Give the dapp an opportunity to do some up front work and generate
1064
1064
// appData metadata for the applied TX
1065
1065
const { status : preCrackSuccess , reason } = await this . app . txPreCrackData ( tx , appData )
@@ -1075,7 +1075,8 @@ class Shardus extends EventEmitter {
1075
1075
1076
1076
const txId = this . app . calculateTxId ( tx ) ;
1077
1077
let timestampReceipt : ShardusTypes . TimestampReceipt ;
1078
- if ( ! injectedTimestamp || injectedTimestamp === - 1 ) {
1078
+ let isMissingInjectedTimestamp = ! injectedTimestamp || injectedTimestamp === - 1
1079
+ if ( isMissingInjectedTimestamp ) {
1079
1080
if ( injectedTimestamp === - 1 ) {
1080
1081
/* prettier-ignore */
1081
1082
if ( logFlags . p2pNonFatal && logFlags . console ) console . log ( "Dapp request to generate a new timestmap for the tx" ) ;
@@ -1085,13 +1086,13 @@ class Shardus extends EventEmitter {
1085
1086
if ( logFlags . p2pNonFatal && logFlags . console ) console . log ( "Network generated a" +
1086
1087
" timestamp" , txId , timestampReceipt ) ;
1087
1088
}
1088
- if ( ! injectedTimestamp && ! timestampReceipt ) {
1089
+ if ( isMissingInjectedTimestamp && ! timestampReceipt ) {
1089
1090
this . shardus_fatal (
1090
1091
"put_noTimestamp" ,
1091
1092
`Transaction timestamp cannot be determined ${ utils . stringifyReduce ( tx ) } `
1092
1093
) ;
1093
1094
this . statistics . incrementCounter ( "txRejected" ) ;
1094
- nestedCountersInstance . countEvent ( "rejected" , " _timestampNotDetermined" ) ;
1095
+ nestedCountersInstance . countEvent ( "rejected" , ` _timestampNotDetermined- ${ loggingContext } ` ) ;
1095
1096
return {
1096
1097
success : false ,
1097
1098
reason : "Transaction timestamp cannot be determined." ,
@@ -1139,7 +1140,7 @@ class Shardus extends EventEmitter {
1139
1140
1140
1141
if ( inRangeOfCurrentTime ( timestamp , txExpireTimeMs , txExpireTimeMs ) === false ) {
1141
1142
/* prettier-ignore */
1142
- this . shardus_fatal ( `tx_outofrange` , `Transaction timestamp out of range: timestamp:${ timestamp } now:${ shardusGetTime ( ) } diff(now-ts):${ shardusGetTime ( ) - timestamp } ${ utils . stringifyReduce ( tx ) } our offset: ${ getNetworkTimeOffset ( ) } ` ) ;
1143
+ this . shardus_fatal ( `tx_outofrange` , `Transaction timestamp out of range: timestamp:${ timestamp } now:${ shardusGetTime ( ) } diff(now-ts):${ shardusGetTime ( ) - timestamp } ${ utils . stringifyReduce ( tx ) } our offset: ${ getNetworkTimeOffset ( ) } loggingContext: ${ loggingContext } ` ) ;
1143
1144
this . statistics . incrementCounter ( "txRejected" ) ;
1144
1145
nestedCountersInstance . countEvent ( "rejected" , "transaction timestamp out of range" ) ;
1145
1146
return { success : false , reason : "Transaction timestamp out of range" , status : 400 } ;
@@ -1609,7 +1610,7 @@ class Shardus extends EventEmitter {
1609
1610
}
1610
1611
} else {
1611
1612
// tx nonce is equal to account nonce
1612
- let result = await this . _timestampAndQueueTransaction ( tx , appData , global , noConsensus )
1613
+ let result = await this . _timestampAndQueueTransaction ( tx , appData , global , noConsensus , 'immediateQueue' )
1613
1614
1614
1615
// start of timestamp logging
1615
1616
if ( logFlags . important_as_error ) {
0 commit comments