@@ -3,7 +3,6 @@ package chainexchange
3
3
import (
4
4
"context"
5
5
"fmt"
6
- "runtime"
7
6
"sync"
8
7
"sync/atomic"
9
8
"time"
@@ -265,11 +264,10 @@ func (p *PubSubChainExchange) cacheAsDiscoveredChain(ctx context.Context, cmsg M
265
264
wanted := p .getChainsDiscoveredAt (ctx , cmsg .Instance )
266
265
discovered := p .getChainsDiscoveredAt (ctx , cmsg .Instance )
267
266
268
- keysBatch := cmsg .Chain .KeysForPrefixes ()
267
+ // keysBatch := cmsg.Chain.KeysForPrefixes()
269
268
for offset := cmsg .Chain .Len () - 1 ; offset >= 0 && ctx .Err () == nil ; offset -- {
270
269
prefix := cmsg .Chain .Prefix (offset )
271
270
//key := keysBatch[offset]
272
- runtime .KeepAlive (keysBatch )
273
271
key := prefix .Key ()
274
272
275
273
if portion , found := wanted .Peek (key ); ! found {
@@ -336,15 +334,13 @@ func (p *PubSubChainExchange) cacheAsWantedChain(ctx context.Context, cmsg Messa
336
334
var notifications []discovery
337
335
wanted := p .getChainsWantedAt (ctx , cmsg .Instance )
338
336
//keysBatch := cmsg.Chain.KeysForPrefixes()
339
- //keysBatch := cmsg.Chain.KeysForPrefixes( )
337
+ time . Sleep ( 5 * time . Millisecond )
340
338
fmt .Println (cmsg .Chain .Len ())
341
- time .Sleep (10 * time .Millisecond )
342
339
343
340
for offset := cmsg .Chain .Len () - 1 ; offset >= 0 && ctx .Err () == nil ; offset -- {
344
341
prefix := cmsg .Chain .Prefix (offset )
345
342
//key := keysBatch[offset]
346
343
key := prefix .Key ()
347
- //runtime.KeepAlive(keysBatch)
348
344
349
345
if portion , found := wanted .Peek (key ); ! found || portion .IsPlaceholder () {
350
346
wanted .Add (key , & chainPortion {
0 commit comments