Skip to content

Commit

Permalink
so stupiiiiiid!
Browse files Browse the repository at this point in the history
  • Loading branch information
chappjc committed Sep 7, 2023
1 parent a35ecb8 commit 5bf0bd9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion db/dcrpg/pgblockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -3379,6 +3379,7 @@ func (pgb *ChainDB) TipToSideChain(mainRoot string) (tipHashStr string, blocksMo
addresses := make(map[string]struct{})
var txnsUpdated, vinsUpdated, votesUpdated, ticketsUpdated, treasuryTxnsUpdates, addrsUpdated int64
for tipHashStr != mainRoot {
log.Infof("TipToSideChain: tipHashStr = %v, mainRoot = %v", tipHashStr, mainRoot)
// 1. Block. Set is_mainchain=false on the tip block, return hash of
// previous block.
now := time.Now()
Expand All @@ -3388,7 +3389,7 @@ func (pgb *ChainDB) TipToSideChain(mainRoot string) (tipHashStr string, blocksMo
tipHash, err)
}
blocksMoved++
log.Debugf("SetMainchainByBlockHash: %v", time.Since(now))
log.Debugf("SetMainchainByBlockHash: %v / tip = %v , prev = %v", time.Since(now), tipHash, previousHash)

// 2. Transactions. Set is_mainchain=false on all transactions in the
// tip block, returning only the number of transactions updated.
Expand Down Expand Up @@ -3470,6 +3471,7 @@ func (pgb *ChainDB) TipToSideChain(mainRoot string) (tipHashStr string, blocksMo

// move on to next block
tipHash = previousHash
tipHashStr = tipHash.String()

pgb.bestBlock.mtx.Lock()
pgb.bestBlock.height, err = pgb.blockHeight(tipHash)
Expand Down

0 comments on commit 5bf0bd9

Please sign in to comment.