95
95
<Buffer 08 06 12 00 28 a8 cf ee db bb 2e 38 00 42 fb 03 11 0a 21 05 c1 2f 19 01 ef 8e 62 8f 8e f3 58 25 42 47 de cc 5d 43 e3 a1 70 dd 22 1e f7 c7 68 63 c9 d5 ... >,
96
96
id: Long { low: -347036081, high: 1342692244, unsigned: true } } }
97
97
*/
98
- //console.log('message ', message )
98
+ //console.log('wsMessage ', wsMessage )
99
99
if ( wsMessage . type !== 1 || ! wsMessage . request ) {
100
100
console . warn ( 'unhandled websocket message' , wsMessage )
101
101
return
@@ -111,10 +111,12 @@ content:
111
111
<Buffer 11 0a 21 05 1c 97 2a 1b d8 d7 35 38 01 4f 90 eb 66 18 9d 96 36 b6 da d5 ac a6 21 ab 8f 02 ce 46 8c 7f d0 29 12 2b 2e 71 4c a5 14 50 2a 10 1a fe 2b f3 ... > }
112
112
*/
113
113
//console.log('env', env)
114
+ //console.log('env timestamp', env.timestamp.toString())
114
115
if ( decodeMessageMap [ env . type ] ) {
115
116
const res = await decodeMessageMap [ env . type ] ( env , ourKeypair )
116
117
if ( res ) {
117
- return { ...res , snodeExp : msg . expiration , hash : msg . hash }
118
+ //console.log('res', res)
119
+ return { ...res , snodeExp : msg . expiration , hash : msg . hash , timestamp : env . timestamp . toString ( ) }
118
120
} else {
119
121
return { }
120
122
}
@@ -123,6 +125,37 @@ content:
123
125
}
124
126
}
125
127
128
+ /*
129
+ pubKeyAsk start https://54.39.15.185:22120/storage_rpc/v1 05aba1ad0ac5f3f5dbd14c54e81ce2a26c58e6fa2b2a901d40eb85246c3ce31b22 xJwZ9reNcRjeJZhLriFxvo3aURsokOsm0c0YN6S7a1c
130
+ recv::checkBox - foundHash xJwZ9reNcRjeJZhLriFxvo3aURsokOsm0c0YN6S7a1c in results? false
131
+ 1669959312621 SessionClient::poll - recvLib got {
132
+ lastHash: 'xJwZ9reNcRjeJZhLriFxvo3aURsokOsm0c0YN6S7a1c',
133
+ messages: []
134
+ }
135
+ pubKeyAsk start https://149.56.113.46:22106/storage_rpc/v1 05aba1ad0ac5f3f5dbd14c54e81ce2a26c58e6fa2b2a901d40eb85246c3ce31b22 xJwZ9reNcRjeJZhLriFxvo3aURsokOsm0c0YN6S7a1c
136
+ recv::checkBox - foundHash xJwZ9reNcRjeJZhLriFxvo3aURsokOsm0c0YN6S7a1c in results? false
137
+ 1669959343209 SessionClient::poll - recvLib got {
138
+ lastHash: 'alN/b0GFAC6FH7jWQtTwXtZ7bkNYT1xK40fvenM4uAY',
139
+ messages: [
140
+ {
141
+ dataMessage: [DataMessage],
142
+ source: '05b69cc33267ada004c60677f39bcc3db91f1cfd841c0a3226a2b2bcc062d28959',
143
+ snodeExp: 1671168929902,
144
+ hash: 'U/wmKjLCEr9ph09APgyTNefmV1b4G+pMdXf6bgVSUgw'
145
+ },
146
+ {
147
+ dataMessage: [DataMessage],
148
+ source: '05b69cc33267ada004c60677f39bcc3db91f1cfd841c0a3226a2b2bcc062d28959',
149
+ snodeExp: 1671168929901,
150
+ hash: 'alN/b0GFAC6FH7jWQtTwXtZ7bkNYT1xK40fvenM4uAY'
151
+ }
152
+ ]
153
+ }
154
+ setLast alN/b0GFAC6FH7jWQtTwXtZ7bkNYT1xK40fvenM4uAY
155
+ 1669959343565 DM from 05b69cc33267ada004c60677f39bcc3db91f1cfd841c0a3226a2b2bcc062d28959 Vector12ProMax: 1234567890xffa
156
+ 1669959343565 DM from 05b69cc33267ada004c60677f39bcc3db91f1cfd841c0a3226a2b2bcc062d28959 Vector12ProMax: 1234567890xffa
157
+ */
158
+
126
159
async function checkBox ( pubKey , ourKeypair , inLasthash , lib , debug ) {
127
160
if ( ! ourKeypair ) {
128
161
console . trace ( 'lib::recv - no ourKeypair' )
@@ -194,6 +227,7 @@ async function checkBox(pubKey, ourKeypair, inLasthash, lib, debug) {
194
227
return handleMessage ( msg , ourKeypair )
195
228
} ) )
196
229
const ts = Date . now ( )
230
+ const msgMap = { } // deduplicate duplicate envelope timestamp
197
231
for ( const m of newMsgs ) {
198
232
//console.log('m', m)
199
233
//console.log('ts', ts, '-', m.snodeExp)
@@ -205,7 +239,9 @@ async function checkBox(pubKey, ourKeypair, inLasthash, lib, debug) {
205
239
//console.log('UPDATING lastHash to', m.hash)
206
240
useLastHash = m . hash
207
241
}
242
+ msgMap [ m . timestamp ] = m
208
243
}
244
+ newMsgs = Object . values ( msgMap )
209
245
}
210
246
//console.log('returning', useLastHash)
211
247
return {
0 commit comments