diff --git a/lib/legacy_mempool.go b/lib/legacy_mempool.go index f74de36b1..e06145f8e 100644 --- a/lib/legacy_mempool.go +++ b/lib/legacy_mempool.go @@ -789,6 +789,10 @@ func MakeDirIfNonExistent(filePath string) error { func (mp *DeSoMempool) OpenTempDBAndDumpTxns() error { blockHeight := uint64(mp.bc.blockTip().Height + 1) + if mp.bc.params.IsPoSBlockHeight(blockHeight) { + glog.V(2).Infof("OpenTempDBAndDumpTxns: Not dumping mempool txns for PoS block %v", blockHeight) + return nil + } allTxns := mp.readOnlyUniversalTransactionList tempMempoolDBDir := filepath.Join(mp.mempoolDir, "temp_mempool_dump") diff --git a/lib/peer.go b/lib/peer.go index 01b0a6faf..ed28ab5d0 100644 --- a/lib/peer.go +++ b/lib/peer.go @@ -111,7 +111,7 @@ type Peer struct { // Inventory stuff. // The inventory that we know the peer already has. - knownInventory lru.Set[InvVect] + knownInventory *lru.Set[InvVect] // Whether the peer is ready to receive INV messages. For a peer that // still needs a mempool download, this is false. @@ -652,7 +652,7 @@ func NewPeer(_id uint64, _conn net.Conn, _isOutbound bool, _netAddr *wire.NetAdd outputQueueChan: make(chan DeSoMessage), peerDisconnectedChan: peerDisconnectedChan, quit: make(chan interface{}), - knownInventory: *lru.NewSet[InvVect](maxKnownInventory), + knownInventory: lru.NewSet[InvVect](maxKnownInventory), blocksToSend: make(map[BlockHash]bool), stallTimeoutSeconds: _stallTimeoutSeconds, minTxFeeRateNanosPerKB: _minFeeRateNanosPerKB, @@ -1365,6 +1365,10 @@ func (pp *Peer) Disconnect(reason string) { // Signaling the quit channel allows all the other goroutines to stop running. close(pp.quit) + // Free the cache of known inventory. + pp.knownInventory.Clear() + pp.knownInventory = nil + // Add the Peer to donePeers so that the ConnectionManager and Server can do any // cleanup they need to do. pp.peerDisconnectedChan <- pp