From 147ffbc583a225833981e14a9c58cd757410ec67 Mon Sep 17 00:00:00 2001 From: Ryan Staudt Date: Fri, 29 Oct 2021 13:20:10 -0500 Subject: [PATCH] netsync: Remove flags from processBlockMsg. This removes the flags param from processBlockMsg and processBlock in SyncManager since it is passed in as BFNone in all instances. The appropriate flags will be determined internally within blockchain. --- internal/netsync/manager.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/internal/netsync/manager.go b/internal/netsync/manager.go index 8e34f105..82d64694 100644 --- a/internal/netsync/manager.go +++ b/internal/netsync/manager.go @@ -177,7 +177,6 @@ type processBlockResponse struct { // way to call ProcessBlock on the internal block chain instance. type processBlockMsg struct { block *dcrutil.Block - flags blockchain.BehaviorFlags reply chan processBlockResponse } @@ -713,9 +712,9 @@ func (m *SyncManager) maybeUpdateIsCurrent() { // the best chain or is now the tip of the best chain due to causing a // reorganize, the fork length will be 0. Orphans are rejected and can be // detected by checking if the error is blockchain.ErrMissingParent. -func (m *SyncManager) processBlock(block *dcrutil.Block, flags blockchain.BehaviorFlags) (int64, error) { +func (m *SyncManager) processBlock(block *dcrutil.Block) (int64, error) { // Process the block to include validation, best chain selection, etc. - forkLen, err := m.cfg.Chain.ProcessBlock(block, flags) + forkLen, err := m.cfg.Chain.ProcessBlock(block, blockchain.BFNone) if err != nil { return 0, err } @@ -752,7 +751,7 @@ func (m *SyncManager) handleBlockMsg(bmsg *blockMsg) { // Also, remove the block from the request maps once it has been processed. // This ensures chain is aware of the block before it is removed from the // maps in order to help prevent duplicate requests. - forkLen, err := m.processBlock(bmsg.block, blockchain.BFNone) + forkLen, err := m.processBlock(bmsg.block) delete(peer.requestedBlocks, *blockHash) delete(m.requestedBlocks, *blockHash) if err != nil { @@ -1372,7 +1371,7 @@ out: } case processBlockMsg: - forkLen, err := m.processBlock(msg.block, msg.flags) + forkLen, err := m.processBlock(msg.block) if err != nil { msg.reply <- processBlockResponse{ forkLen: forkLen, @@ -1656,8 +1655,7 @@ func (m *SyncManager) requestFromPeer(p *peerpkg.Peer, blocks, voteHashes, func (m *SyncManager) ProcessBlock(block *dcrutil.Block) error { reply := make(chan processBlockResponse, 1) select { - case m.msgChan <- processBlockMsg{block: block, flags: blockchain.BFNone, - reply: reply}: + case m.msgChan <- processBlockMsg{block: block, reply: reply}: case <-m.quit: }