[lbry] blockchain: support force active fork deployment

This commit is contained in:
Brannon King 2021-07-29 17:21:51 -04:00 committed by Roy Lee
parent a7b3ed5c29
commit f8a5df1b87
3 changed files with 13 additions and 0 deletions

View file

@ -302,6 +302,12 @@ func (b *BlockChain) deploymentState(prevNode *blockNode, deploymentID uint32) (
}
deployment := &b.chainParams.Deployments[deploymentID]
// added to mimic LBRYcrd:
if deployment.ForceActiveAt > 0 && prevNode != nil && prevNode.height+1 >= deployment.ForceActiveAt {
return ThresholdActive, nil
}
checker := deploymentChecker{deployment: deployment, chain: b}
cache := &b.deploymentCaches[deploymentID]

View file

@ -195,6 +195,12 @@ func (b *BlockChain) calcNextBlockVersion(prevNode *blockNode) (int32, error) {
expectedVersion := uint32(vbTopBits)
for id := 0; id < len(b.chainParams.Deployments); id++ {
deployment := &b.chainParams.Deployments[id]
// added to mimic LBRYcrd:
if deployment.ForceActiveAt > 0 && prevNode != nil && prevNode.height+1 >= deployment.ForceActiveAt {
continue
}
cache := &b.deploymentCaches[id]
checker := deploymentChecker{deployment: deployment, chain: b}
state, err := b.thresholdState(prevNode, checker, cache)

View file

@ -1294,6 +1294,7 @@ func handleGetBlockChainInfo(s *rpcServer, cmd interface{}, closeChan <-chan str
Bit: deploymentDetails.BitNumber,
StartTime2: int64(deploymentDetails.StartTime),
Timeout: int64(deploymentDetails.ExpireTime),
Since: deploymentDetails.ForceActiveAt,
}
}