X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=config%2Fgenesis.go;h=8cd53259ca2ebcc27c575794e801e973b310e82e;hb=f7f12ea310fc0a1e49f4ccbd3d0d79f1664db045;hp=e57f943db3bcd8dfe1a352f3aa9eb4090a8aa1e9;hpb=b9175a5cd6c0fe90429c65cb5f7112e6845cb6c0;p=bytom%2Fvapor.git diff --git a/config/genesis.go b/config/genesis.go index e57f943d..8cd53259 100644 --- a/config/genesis.go +++ b/config/genesis.go @@ -13,21 +13,25 @@ import ( "github.com/vapor/protocol/vm/vmutil" ) -func FederationProgrom(c *Config) []byte { +func FederationPMultiSigScript(c *Config) []byte { xpubs := c.Federation.Xpubs - fedpegScript, err := vmutil.P2SPMultiSigProgram(chainkd.XPubKeys(xpubs), c.Federation.Quorum) + program, err := vmutil.P2SPMultiSigProgram(chainkd.XPubKeys(xpubs), c.Federation.Quorum) if err != nil { - log.Panicf("Failed generate federation scirpt for federation: " + err.Error()) + log.Panicf("fail to generate federation scirpt for federation: %v", err) } - scriptHash := crypto.Sha256(fedpegScript) + return program +} - control, err := vmutil.P2WSHProgram(scriptHash) +func FederationWScript(c *Config) []byte { + script := FederationPMultiSigScript(c) + scriptHash := crypto.Sha256(script) + wscript, err := vmutil.P2WSHProgram(scriptHash) if err != nil { - log.Panicf("Fail converts scriptHash to program on FederationProgrom: %v", err) + log.Panicf("Fail converts scriptHash to witness: %v", err) } - return control + return wscript } func GenesisTx() *types.Tx { @@ -36,7 +40,7 @@ func GenesisTx() *types.Tx { log.Panicf("fail on decode genesis tx output control program") } - coinbaseInput := FederationProgrom(CommonConfig) + coinbaseInput := FederationWScript(CommonConfig) txData := types.TxData{ Version: 1, @@ -44,7 +48,7 @@ func GenesisTx() *types.Tx { types.NewCoinbaseInput(coinbaseInput[:]), }, Outputs: []*types.TxOutput{ - types.NewIntraChainOutput(*consensus.BTMAssetID, consensus.InitialBlockSubsidy, contract), + types.NewIntraChainOutput(*consensus.BTMAssetID, consensus.BlockSubsidy(0), contract), }, } return types.NewTx(txData) @@ -70,7 +74,7 @@ func mainNetGenesisBlock() *types.Block { BlockHeader: types.BlockHeader{ Version: 1, Height: 0, - Timestamp: 1524549600000, + Timestamp: 1561600800002, BlockCommitment: types.BlockCommitment{ TransactionsMerkleRoot: merkleRoot, TransactionStatusHash: txStatusHash, @@ -101,7 +105,7 @@ func testNetGenesisBlock() *types.Block { BlockHeader: types.BlockHeader{ Version: 1, Height: 0, - Timestamp: 1528945000000, + Timestamp: 1561600800001, BlockCommitment: types.BlockCommitment{ TransactionsMerkleRoot: merkleRoot, TransactionStatusHash: txStatusHash, @@ -132,7 +136,7 @@ func soloNetGenesisBlock() *types.Block { BlockHeader: types.BlockHeader{ Version: 1, Height: 0, - Timestamp: 1528945000000, + Timestamp: 1561600800000, BlockCommitment: types.BlockCommitment{ TransactionsMerkleRoot: merkleRoot, TransactionStatusHash: txStatusHash,