Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Remove variables for testnet v1.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcvernaleo committed Mar 17, 2017
1 parent 01a0d76 commit ef71103
Show file tree
Hide file tree
Showing 21 changed files with 135 additions and 323 deletions.
2 changes: 1 addition & 1 deletion blockchain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2195,7 +2195,7 @@ func (b *BlockChain) BestSnapshot() *BestState {
func (b *BlockChain) maxBlockSize(prevNode *blockNode) (int64, error) {
// Hard fork voting on block size is only enabled on testnet v1 and
// simnet.
if b.chainParams.Net != wire.TestNet && b.chainParams.Net != wire.SimNet {
if b.chainParams.Net != wire.SimNet {
return int64(b.chainParams.MaximumBlockSizes[0]), nil
}

Expand Down
8 changes: 4 additions & 4 deletions blockchain/stake/staketx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ func TestVerifyRealTxs(t *testing.T) {
ssrtxTx := dcrutil.NewTx(ssrtxMtx)

ssrtxTypes, ssrtxAddrs, ssrtxAmts, err :=
stake.TxSSRtxStakeOutputInfo(ssrtxTx.MsgTx(), &chaincfg.TestNetParams)
stake.TxSSRtxStakeOutputInfo(ssrtxTx.MsgTx(), &chaincfg.TestNet2Params)
if err != nil {
t.Errorf("Unexpected GetSSRtxStakeOutputInfo error: %v", err.Error())
}
Expand Down Expand Up @@ -1394,7 +1394,7 @@ func TestVerifyRealTxs(t *testing.T) {
sstxTypes, sstxAddrs, sstxAmts, _, sstxRules, sstxLimits =
stake.TxSStxStakeOutputInfo(sstxTx.MsgTx())
ssrtxTypes, ssrtxAddrs, ssrtxAmts, err =
stake.TxSSRtxStakeOutputInfo(ssrtxTx.MsgTx(), &chaincfg.TestNetParams)
stake.TxSSRtxStakeOutputInfo(ssrtxTx.MsgTx(), &chaincfg.TestNet2Params)
if err != nil {
t.Errorf("Unexpected GetSSRtxStakeOutputInfo error: %v", err.Error())
}
Expand All @@ -1420,7 +1420,7 @@ func TestVerifyRealTxs(t *testing.T) {
sstxTypes, sstxAddrs, sstxAmts, _, sstxRules, sstxLimits =
stake.TxSStxStakeOutputInfo(sstxTx.MsgTx())
ssrtxTypes, ssrtxAddrs, ssrtxAmts, err =
stake.TxSSRtxStakeOutputInfo(ssrtxTx.MsgTx(), &chaincfg.TestNetParams)
stake.TxSSRtxStakeOutputInfo(ssrtxTx.MsgTx(), &chaincfg.TestNet2Params)
if err != nil {
t.Errorf("Unexpected GetSSRtxStakeOutputInfo error: %v", err.Error())
}
Expand Down Expand Up @@ -1451,7 +1451,7 @@ func TestVerifyRealTxs(t *testing.T) {
sstxTypes, sstxAddrs, sstxAmts, _, sstxRules, sstxLimits =
stake.TxSStxStakeOutputInfo(sstxTx.MsgTx())
ssrtxTypes, ssrtxAddrs, ssrtxAmts, err =
stake.TxSSRtxStakeOutputInfo(ssrtxTx.MsgTx(), &chaincfg.TestNetParams)
stake.TxSSRtxStakeOutputInfo(ssrtxTx.MsgTx(), &chaincfg.TestNet2Params)
if err != nil {
t.Errorf("Unexpected GetSSRtxStakeOutputInfo error: %v", err.Error())
}
Expand Down
6 changes: 3 additions & 3 deletions blockchain/stakeversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ func TestCalcWantHeight(t *testing.T) {
multiplier: 5000,
},
{
name: "testnet params",
skip: chaincfg.TestNetParams.StakeValidationHeight,
interval: chaincfg.TestNetParams.StakeVersionInterval,
name: "testnet2 params",
skip: chaincfg.TestNet2Params.StakeValidationHeight,
interval: chaincfg.TestNet2Params.StakeVersionInterval,
multiplier: 1000,
},
{
Expand Down
28 changes: 1 addition & 27 deletions chaincfg/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ var genesisBlock = wire.MsgBlock{
// network (genesis block).
var genesisHash = genesisBlock.BlockHash()

// TestNet ------------------------------------------------------------------------

// genesisCoinbaseTxLegacy is the coinbase transaction for the genesis block for
// the test network.
var genesisCoinbaseTxLegacy = wire.MsgTx{
Expand Down Expand Up @@ -135,30 +133,6 @@ var genesisCoinbaseTxLegacy = wire.MsgTx{
Expiry: 0,
}

// testNetGenesisMerkleRoot is the hash of the first transaction in the genesis block
// for the test network.
var testNetGenesisMerkleRoot = genesisCoinbaseTxLegacy.TxHash()

// testNetGenesisBlock defines the genesis block of the block chain which
// serves as the public transaction ledger for the test network (version 3).
var testNetGenesisBlock = wire.MsgBlock{
Header: wire.BlockHeader{
Version: 1,
PrevBlock: chainhash.Hash{},
MerkleRoot: testNetGenesisMerkleRoot,
Timestamp: time.Unix(1453908222, 0), // 2016-01-27 TestNet9
Bits: 0x1e00ffff,
SBits: 20000000,
Nonce: 0x18aea41a,
StakeVersion: 0,
},
Transactions: []*wire.MsgTx{&genesisCoinbaseTxLegacy},
}

// testNetGenesisHash is the hash of the first block in the block chain for the
// test network.
var testNetGenesisHash = testNetGenesisBlock.BlockHash()

// TestNet2 ------------------------------------------------------------------------

// testNetGenesisMerkleRoot is the hash of the first transaction in the genesis block
Expand All @@ -171,7 +145,7 @@ var testNet2GenesisBlock = wire.MsgBlock{
Header: wire.BlockHeader{
Version: 4,
PrevBlock: chainhash.Hash{},
MerkleRoot: testNetGenesisMerkleRoot,
MerkleRoot: testNet2GenesisMerkleRoot,
Timestamp: time.Unix(1489550400, 0), // 2017-03-15 TestNet10
Bits: 0x1e00ffff,
SBits: 20000000,
Expand Down
12 changes: 6 additions & 6 deletions chaincfg/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ func TestGenesisBlock(t *testing.T) {
func TestTestNetGenesisBlock(t *testing.T) {
// Encode the genesis block to raw bytes.
var buf bytes.Buffer
err := TestNetParams.GenesisBlock.Serialize(&buf)
err := TestNet2Params.GenesisBlock.Serialize(&buf)
if err != nil {
t.Fatalf("TestTestNetGenesisBlock: %v", err)
}

testNetGenesisBlockBytes, _ := hex.DecodeString("0100000000000000000" +
testNetGenesisBlockBytes, _ := hex.DecodeString("0400000000000000000" +
"000000000000000000000000000000000000000000000000000000571a3f8bb" +
"1903091a18edd3efbc324c79876764af2424071a480d3f04ea16a2000000000" +
"000000000000000000000000000000000000000000000000000000000000000" +
"000000000000000000000000ffff001e002d310100000000000000000000000" +
"0fee0a8561aa4ae180000000000000000000000000000000000000000000000" +
"040bcc8581aa4ae180000000000000000000000000000000000000000000000" +
"000000000000000000000000000101000000010000000000000000000000000" +
"000000000000000000000000000000000000000ffffffff00ffffffff010000" +
"0000000000000000434104678afdb0fe5548271967f1a67130b7105cd6a828e" +
Expand All @@ -85,11 +85,11 @@ func TestTestNetGenesisBlock(t *testing.T) {
}

// Check hash of the block against expected hash.
hash := TestNetParams.GenesisBlock.BlockHash()
if !TestNetParams.GenesisHash.IsEqual(&hash) {
hash := TestNet2Params.GenesisBlock.BlockHash()
if !TestNet2Params.GenesisHash.IsEqual(&hash) {
t.Fatalf("TestTestNetGenesisBlock: Genesis block hash does "+
"not appear valid - got %v, want %v", spew.Sdump(hash),
spew.Sdump(TestNetParams.GenesisHash))
spew.Sdump(TestNet2Params.GenesisHash))
}
}

Expand Down
2 changes: 1 addition & 1 deletion chaincfg/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func validateAgendas() {
case 0:
params = MainNetParams
case 1:
params = TestNetParams
params = TestNet2Params
case 2:
params = SimNetParams
default:
Expand Down
151 changes: 0 additions & 151 deletions chaincfg/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,156 +559,6 @@ var MainNetParams = Params{
BlockOneLedger: BlockOneLedgerMainNet,
}

// TestNetParams defines the network parameters for the test currency network.
// This network is sometimes simply called "testnet".
var TestNetParams = Params{
Name: "testnet",
Net: wire.TestNet,
DefaultPort: "19108",
DNSSeeds: []string{
"testnet-seed.decred.mindcry.org",
"testnet-seed.decred.netpurgatory.org",
"testnet.decredseed.org",
"testnet-seed.decred.org",
},

// Chain parameters
GenesisBlock: &testNetGenesisBlock,
GenesisHash: &testNetGenesisHash,
PowLimit: testNetPowLimit,
PowLimitBits: 0x1e00ffff,
ReduceMinDifficulty: false,
MinDiffReductionTime: 0, // Does not apply since ReduceMinDifficulty false
GenerateSupported: true,
MaximumBlockSizes: []int{1000000, 1310720},
MaxTxSize: 1000000,
TargetTimePerBlock: time.Minute * 2,
WorkDiffAlpha: 1,
WorkDiffWindowSize: 144,
WorkDiffWindows: 20,
TargetTimespan: time.Minute * 2 * 144, // TimePerBlock * WindowSize
RetargetAdjustmentFactor: 4,

// Subsidy parameters.
BaseSubsidy: 2500000000, // 25 Coin
MulSubsidy: 100,
DivSubsidy: 101,
SubsidyReductionInterval: 2048,
WorkRewardProportion: 6,
StakeRewardProportion: 3,
BlockTaxProportion: 1,

// Checkpoints ordered from oldest to newest.
Checkpoints: []Checkpoint{
{2900, newHashFromStr("000000000012475b579cd16d670f42982648e5dbf81d84960c83fd1990d84cbe")},
{27550, newHashFromStr("00000000183a9f9b8fa6accc32c7abb2456a8e0e12baf045788a74114dbbebe3")},
{61540, newHashFromStr("0000000003bc7461b7cd821fb258de72b9b0c7604b1a5346d29eb132d846ccb0")},
{97110, newHashFromStr("0000000006ae0065cf97102844854966d907d6e50ab18894679fbad1dfc017b4")},
{132220, newHashFromStr("000000000372a1bf5ad5c42361672bfeae6a513ad25ab9eaf4590f890e090c36")},
{146740, newHashFromStr("00000000003300fa29af1b0066c688513f4f188f95edcff55dcdeb4e8f2c3b5e")},
{162230, newHashFromStr("0000000006741ab11e44af3cebc1c52905f873b4e059a1013da63bc076a3edbb")},
{173750, newHashFromStr("0000000000fe0a2f55589d8b75502f8adc26be95971a16d12d7ea65da5a0a507")},
{197920, newHashFromStr("000000000174a97eed678549df66b4025a8ff4b5034e7b0fdc63d1112d4716ab")},
{223050, newHashFromStr("00000000065827e0fd67067f2268f14890a1b7e863b1fa7dee627a3d4b7d33b5")},
{257350, newHashFromStr("000000000265019c4f9412977efcaf4811462992e6d424e251e7a91424c454ba")},
},

// Consensus rule change deployments.
//
// The miner confirmation window is defined as:
// target proof of work timespan / target proof of work spacing
RuleChangeActivationQuorum: 2520, // 10 % of RuleChangeActivationInterval * TicketsPerBlock
RuleChangeActivationMultiplier: 3, // 75%
RuleChangeActivationDivisor: 4,
RuleChangeActivationInterval: 5040, // 1 week
Deployments: map[uint32][]ConsensusDeployment{
4: {{
Vote: Vote{
Id: VoteIDMaxBlockSize,
Description: "Change maximum allowed block size from 1MB to 1.25MiB",
Mask: 0x0006, // Bits 1 and 2
Choices: []Choice{{
Id: "abstain",
Description: "abstain voting for change",
Bits: 0x0000,
IsIgnore: true,
IsNo: false,
}, {
Id: "no",
Description: "reject changing max allowed block size",
Bits: 0x0002, // Bit 1
IsIgnore: false,
IsNo: true,
}, {
Id: "yes",
Description: "accept changing max allowed block size",
Bits: 0x0004, // Bit 2
IsIgnore: false,
IsNo: false,
}},
},
StartTime: 1486598400, // Feb 9th, 2017
ExpireTime: 1496966400, // Jun 9th, 2017
}},
},

// Enforce current block version once majority of the network has
// upgraded.
// 51% (51 / 100)
// Reject previous block versions once a majority of the network has
// upgraded.
// 75% (75 / 100)
BlockEnforceNumRequired: 51,
BlockRejectNumRequired: 75,
BlockUpgradeNumToCheck: 100,

// Mempool parameters
RelayNonStdTxs: true,

// Address encoding magics
NetworkAddressPrefix: "T",
PubKeyAddrID: [2]byte{0x28, 0xf7}, // starts with Tk
PubKeyHashAddrID: [2]byte{0x0f, 0x21}, // starts with Ts
PKHEdwardsAddrID: [2]byte{0x0f, 0x01}, // starts with Te
PKHSchnorrAddrID: [2]byte{0x0e, 0xe3}, // starts with TS
ScriptHashAddrID: [2]byte{0x0e, 0xfc}, // starts with Tc
PrivateKeyID: [2]byte{0x23, 0x0e}, // starts with Pt

// BIP32 hierarchical deterministic extended key magics
HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x97}, // starts with tprv
HDPublicKeyID: [4]byte{0x04, 0x35, 0x87, 0xd1}, // starts with tpub

// BIP44 coin type used in the hierarchical deterministic path for
// address generation.
HDCoinType: 11,

// Decred PoS parameters
MinimumStakeDiff: 20000000, // 0.2 Coin
TicketPoolSize: 1024,
TicketsPerBlock: 5,
TicketMaturity: 16,
TicketExpiry: 6144, // 6*TicketPoolSize
CoinbaseMaturity: 16,
SStxChangeMaturity: 1,
TicketPoolSizeWeight: 4,
StakeDiffAlpha: 1,
StakeDiffWindowSize: 144,
StakeDiffWindows: 20,
StakeVersionInterval: 144 * 2 * 7, // ~1 week
MaxFreshStakePerBlock: 20, // 4*TicketsPerBlock
StakeEnabledHeight: 16 + 16, // CoinbaseMaturity + TicketMaturity
StakeValidationHeight: 768, // Arbitrary
StakeBaseSigScript: []byte{0xDE, 0xAD, 0xBE, 0xEF},
StakeMajorityMultiplier: 3,
StakeMajorityDivisor: 4,

// Decred organization related parameters.
// Organization address is TcemyEtyHSg9L7jww7uihv9BJfKL6YGiZYn
OrganizationPkScript: hexDecode("a9144fa6cbd0dbe5ec407fe4c8ad374e667771fa0d4487"),
OrganizationPkScriptVersion: 0,
BlockOneLedger: BlockOneLedgerTestNet,
}

// TestNet2Params defines the network parameters for the test currency network.
// This network is sometimes simply called "testnet".
// This is the second public iteration of testnet.
Expand Down Expand Up @@ -1156,7 +1006,6 @@ func (p *Params) LatestCheckpointHeight() int64 {
func init() {
// Register all default networks when the package is initialized.
mustRegister(&MainNetParams)
mustRegister(&TestNetParams)
mustRegister(&TestNet2Params)
mustRegister(&SimNetParams)
}
Loading

0 comments on commit ef71103

Please sign in to comment.