diff options
author | bojie <bojie@dexon.org> | 2018-11-27 17:22:56 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:19 +0800 |
commit | ceb3106eec3a31ecc500d40a0a0750a1b9f2a04f (patch) | |
tree | b412408f77a0f383db8d1ea2af6c538a739ea44c | |
parent | 54888db8d4e8b17d37509dbb1d8a1513cad3bd06 (diff) | |
download | go-tangerine-ceb3106eec3a31ecc500d40a0a0750a1b9f2a04f.tar.gz go-tangerine-ceb3106eec3a31ecc500d40a0a0750a1b9f2a04f.tar.zst go-tangerine-ceb3106eec3a31ecc500d40a0a0750a1b9f2a04f.zip |
cmd: fix tests (#55)
-rw-r--r-- | cmd/gdex/consolecmd_test.go | 16 | ||||
-rw-r--r-- | cmd/gdex/dao_test.go | 4 | ||||
-rw-r--r-- | cmd/gdex/genesis_test.go | 13 | ||||
-rw-r--r-- | console/console.go | 1 |
4 files changed, 19 insertions, 15 deletions
diff --git a/cmd/gdex/consolecmd_test.go b/cmd/gdex/consolecmd_test.go index 9a79dcd90..37f94cdc4 100644 --- a/cmd/gdex/consolecmd_test.go +++ b/cmd/gdex/consolecmd_test.go @@ -31,7 +31,7 @@ import ( ) const ( - ipcAPIs = "admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 shh:1.0 txpool:1.0 web3:1.0" + ipcAPIs = "admin:1.0 debug:1.0 dexcon:1.0 eth:1.0 net:1.0 personal:1.0 rpc:1.0 shh:1.0 txpool:1.0 web3:1.0" httpAPIs = "eth:1.0 net:1.0 rpc:1.0 web3:1.0" ) @@ -51,16 +51,15 @@ func TestConsoleWelcome(t *testing.T) { gdex.SetTemplateFunc("goarch", func() string { return runtime.GOARCH }) gdex.SetTemplateFunc("gover", runtime.Version) gdex.SetTemplateFunc("gethver", func() string { return params.VersionWithMeta }) - gdex.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) }) + gdex.SetTemplateFunc("dextime", func() string { return time.Unix(1540024964, 0).Format(time.RFC1123) }) gdex.SetTemplateFunc("apis", func() string { return ipcAPIs }) // Verify the actual welcome message to the required template gdex.Expect(` Welcome to the Geth JavaScript console! -instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}} -coinbase: {{.Etherbase}} -at block: 0 ({{niltime}}) +instance: gdex/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}} +at block: 0 ({{dextime}}) datadir: {{.Datadir}} modules: {{apis}} @@ -135,7 +134,7 @@ func testAttachWelcome(t *testing.T, gdex *testgdex, endpoint, apis string) { attach.SetTemplateFunc("gover", runtime.Version) attach.SetTemplateFunc("gethver", func() string { return params.VersionWithMeta }) attach.SetTemplateFunc("etherbase", func() string { return gdex.Etherbase }) - attach.SetTemplateFunc("niltime", func() string { return time.Unix(0, 0).Format(time.RFC1123) }) + attach.SetTemplateFunc("dextime", func() string { return time.Unix(1540024964, 0).Format(time.RFC1123) }) attach.SetTemplateFunc("ipc", func() bool { return strings.HasPrefix(endpoint, "ipc") }) attach.SetTemplateFunc("datadir", func() string { return gdex.Datadir }) attach.SetTemplateFunc("apis", func() string { return apis }) @@ -144,9 +143,8 @@ func testAttachWelcome(t *testing.T, gdex *testgdex, endpoint, apis string) { attach.Expect(` Welcome to the Geth JavaScript console! -instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}} -coinbase: {{etherbase}} -at block: 0 ({{niltime}}){{if ipc}} +instance: gdex/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}} +at block: 0 ({{dextime}}){{if ipc}} datadir: {{datadir}}{{end}} modules: {{apis}} diff --git a/cmd/gdex/dao_test.go b/cmd/gdex/dao_test.go index 19340fa1b..c4d3d0cc2 100644 --- a/cmd/gdex/dao_test.go +++ b/cmd/gdex/dao_test.go @@ -77,7 +77,7 @@ var daoProForkGenesis = `{ } }` -var daoGenesisHash = common.HexToHash("5e1fc79cb4ffa4739177b5408045cd5d51c6cf766133f23f7cd72ee1f8d790e0") +var daoGenesisHash = common.HexToHash("0x81e17c54ca08eb60d9455df5600813b637fc460b86ccbd6ac322fb2d2bd2a935") var daoGenesisForkBlock = big.NewInt(314) // TestDAOForkBlockNewChain tests that the DAO hard-fork number and the nodes support/opposition is correctly @@ -127,7 +127,7 @@ func testDAOForkBlockNewChain(t *testing.T, test int, genesis string, expectBloc } defer db.Close() - genesisHash := common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3") + genesisHash := common.HexToHash("0x52b1459248252fcec3e9429362bdbc576c09515cfac0a87b278b2bf98d640c42") if genesis != "" { genesisHash = daoGenesisHash } diff --git a/cmd/gdex/genesis_test.go b/cmd/gdex/genesis_test.go index 05da35563..38db9e0c4 100644 --- a/cmd/gdex/genesis_test.go +++ b/cmd/gdex/genesis_test.go @@ -56,7 +56,11 @@ var customGenesisTests = []struct { "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp" : "0x00", - "config" : {} + "config" : { + "dexcon": { + "lambdaBA": 250, + }, + }, }`, query: "eth.getBlock(0).nonce", result: "0x0000000000000042", @@ -76,8 +80,11 @@ var customGenesisTests = []struct { "config" : { "homesteadBlock" : 314, "daoForkBlock" : 141, - "daoForkSupport" : true - } + "daoForkSupport" : true, + "dexcon": { + "lambdaBA": 250, + }, + }, }`, query: "eth.getBlock(0).nonce", result: "0x0000000000000042", diff --git a/console/console.go b/console/console.go index 07b27c6f0..c36b2e0c4 100644 --- a/console/console.go +++ b/console/console.go @@ -278,7 +278,6 @@ func (c *Console) Welcome() { fmt.Fprintf(c.printer, "Welcome to the Geth JavaScript console!\n\n") c.jsre.Run(` console.log("instance: " + web3.version.node); - console.log("coinbase: " + eth.coinbase); console.log("at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")"); console.log(" datadir: " + admin.datadir); `) |