mirror of
https://github.com/FlipsideCrypto/dcrd.git
synced 2026-02-06 10:56:47 +00:00
[release-v1.3] blockchain: Avoid deployment expiration in tests.
This modifies the test code which deals with testing feature deployments to clone the parameters and modify them such that the deployment being tested never expires.
This commit is contained in:
parent
5bb4840673
commit
0fe564967f
@ -5,6 +5,7 @@
|
||||
package blockchain
|
||||
|
||||
import (
|
||||
"math"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -22,18 +23,24 @@ func testLNFeaturesDeployment(t *testing.T, params *chaincfg.Params, deploymentV
|
||||
const baseConsensusScriptVerifyFlags = txscript.ScriptVerifyCleanStack |
|
||||
txscript.ScriptVerifyCheckLockTimeVerify
|
||||
|
||||
// Find the correct deployment for the LN features agenda.
|
||||
var deployment chaincfg.ConsensusDeployment
|
||||
// Find the correct deployment for the LN features agenda and ensure it
|
||||
// never expires to prevent test failures when the real expiration time
|
||||
// passes. Also, clone the provided parameters first to avoid mutating
|
||||
// them.
|
||||
params = cloneParams(params)
|
||||
var deployment *chaincfg.ConsensusDeployment
|
||||
deployments := params.Deployments[deploymentVer]
|
||||
for _, depl := range deployments {
|
||||
for deploymentID, depl := range deployments {
|
||||
if depl.Vote.Id == chaincfg.VoteIDLNFeatures {
|
||||
deployment = depl
|
||||
deployment = &deployments[deploymentID]
|
||||
break
|
||||
}
|
||||
}
|
||||
if deployment.Vote.Id != chaincfg.VoteIDLNFeatures {
|
||||
if deployment == nil {
|
||||
t.Fatalf("Unable to find consensus deployement for %s",
|
||||
chaincfg.VoteIDLNFeatures)
|
||||
}
|
||||
deployment.ExpireTime = math.MaxUint64 // Never expires.
|
||||
|
||||
// Find the correct choice for the yes vote.
|
||||
const yesVoteID = "yes"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user