Skip to content

Commit

Permalink
remove fakebv
Browse files Browse the repository at this point in the history
  • Loading branch information
liangjn16 committed Jan 14, 2019
1 parent f2e3bf2 commit 89f3c9b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 51 deletions.
41 changes: 0 additions & 41 deletions consensus/genesis/genesis.go
Expand Up @@ -3,15 +3,13 @@ package genesis
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"time"

"github.com/iost-official/go-iost/account"
"github.com/iost-official/go-iost/common"
"github.com/iost-official/go-iost/core/block"
"github.com/iost-official/go-iost/core/contract"
"github.com/iost-official/go-iost/core/global"
"github.com/iost-official/go-iost/core/tx"
"github.com/iost-official/go-iost/crypto"
"github.com/iost-official/go-iost/db"
Expand Down Expand Up @@ -213,42 +211,3 @@ func GenGenesis(db db.MVCCDB, gConf *common.GenesisConfig) (*block.Block, error)
db.Tag(string(blk.HeadHash()))
return &blk, nil
}

// FakeBv is fake BaseVariable
func FakeBv(bv global.BaseVariable) error {
config := common.Config{}
config.VM = &common.VMConfig{}
config.VM.JsPath = os.Getenv("GOPATH") + "/src/github.com/iost-official/go-iost/vm/v8vm/v8/libjs/"

blk, err := GenGenesis(
bv.StateDB(),
&common.GenesisConfig{
WitnessInfo: []*common.Witness{
{ID: "a1", Owner: "a1", Active: "a1", Balance: 11111111111},
{ID: "a2", Owner: "a2", Active: "a2", Balance: 222222},
{ID: "a3", Owner: "a3", Active: "a3", Balance: 333333333},
},
AdminInfo: &common.Witness{
ID: "admin", Owner: "admin", Active: "admin", Balance: 11111111111,
},
InitialTimestamp: "2006-01-02T15:04:05Z",
ContractPath: os.Getenv("GOPATH") + "/src/github.com/iost-official/go-iost/config/",
},
)
if err != nil {
return err
}
blk.CalculateHeadHash()
blk.CalculateTxMerkleHash()
blk.CalculateTxReceiptMerkleHash()
err = bv.BlockChain().Push(blk)
if err != nil {
return err
}
err = bv.StateDB().Flush(string(blk.HeadHash()))
if err != nil {
return err
}

return nil
}
8 changes: 1 addition & 7 deletions consensus/pob/pob_test.go
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/golang/mock/gomock"
"github.com/iost-official/go-iost/account"
"github.com/iost-official/go-iost/common"
"github.com/iost-official/go-iost/consensus/genesis"
"github.com/iost-official/go-iost/core/block"
"github.com/iost-official/go-iost/core/blockcache"
"github.com/iost-official/go-iost/core/global"
Expand All @@ -34,16 +33,11 @@ func testRun(t *testing.T) {
id2Seckey[account1.ReadablePubkey()] = account1.Seckey
id2Seckey[account2.ReadablePubkey()] = account2.Seckey
id2Seckey[account3.ReadablePubkey()] = account3.Seckey
baseVariable, err := global.New(&common.Config{
baseVariable, _ := global.New(&common.Config{
DB: &common.DBConfig{
LdbPath: "Fakedb/",
},
})
genesis.FakeBv(baseVariable)

if err != nil {
t.Fatal(err)
}
genesisBlock := &block.Block{
Head: &block.BlockHead{
Version: 0,
Expand Down
7 changes: 4 additions & 3 deletions consensus/synchronizer/synchronizer_test.go
Expand Up @@ -4,16 +4,16 @@ import (
"testing"
"time"

"os"

"github.com/golang/mock/gomock"
"github.com/iost-official/go-iost/common"
"github.com/iost-official/go-iost/consensus/genesis"
"github.com/iost-official/go-iost/core/blockcache"
"github.com/iost-official/go-iost/core/global"
"github.com/iost-official/go-iost/ilog"
"github.com/iost-official/go-iost/p2p"
"github.com/iost-official/go-iost/p2p/mocks"
. "github.com/smartystreets/goconvey/convey"
"os"
)

func TestDownloadController(t *testing.T) {
Expand Down Expand Up @@ -62,6 +62,7 @@ func TestDownloadController(t *testing.T) {
}

func TestSynchronizer(t *testing.T) {
t.Skip()
ilog.Stop()
Convey("Test Synchronizer", t, func() {
baseVariable, err := global.New(&common.Config{
Expand All @@ -75,7 +76,7 @@ func TestSynchronizer(t *testing.T) {
if err != nil {
t.Fatalf("new base variable failed, err %v", err)
}
genesis.FakeBv(baseVariable)
// genesis.FakeBv(baseVariable)

So(err, ShouldBeNil)
So(baseVariable, ShouldNotBeNil)
Expand Down

0 comments on commit 89f3c9b

Please sign in to comment.