Skip to content

Commit

Permalink
Merge 859a623 into 9c7254c
Browse files Browse the repository at this point in the history
  • Loading branch information
erickyan86 committed May 13, 2019
2 parents 9c7254c + 859a623 commit 733b103
Show file tree
Hide file tree
Showing 81 changed files with 2,104 additions and 1,206 deletions.
15 changes: 1 addition & 14 deletions accountmanager/accountmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1187,19 +1187,6 @@ func (am *AccountManager) IncAsset2Acct(fromName common.Name, toName common.Name
return am.AddAccountBalanceByID(toName, assetID, amount)
}

//AddBalanceByName add balance to account
//func (am *AccountManager) AddBalanceByName(accountName common.Name, assetID uint64, amount *big.Int) error {
// acct, err := am.GetAccountByName(accountName)
// if err != nil {
// return err
// }
// if acct == nil {
// return ErrAccountNotExist
// }
// return acct.AddBalanceByID(assetID, amount)
// rerturn
//}

//Process account action
func (am *AccountManager) Process(accountManagerContext *types.AccountManagerContext) ([]*types.InternalAction, error) {
snap := am.sdb.Snapshot()
Expand All @@ -1213,7 +1200,7 @@ func (am *AccountManager) Process(accountManagerContext *types.AccountManagerCon
func (am *AccountManager) process(accountManagerContext *types.AccountManagerContext) ([]*types.InternalAction, error) {
action := accountManagerContext.Action
number := accountManagerContext.Number
if err := action.CheckValid(accountManagerContext.ChainConfig); err != nil {
if err := action.Check(accountManagerContext.ChainConfig); err != nil {
return nil, err
}

Expand Down
4 changes: 2 additions & 2 deletions asset/asset_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
)

type AssetObject struct {
AssetId uint64 `json:"assetId,omitempty"`
Number uint64 `json:"number,omitempty"`
AssetId uint64 `json:"assetId"`
Number uint64 `json:"number"`
AssetName string `json:"assetName"`
Symbol string `json:"symbol"`
Amount *big.Int `json:"amount"`
Expand Down
4 changes: 2 additions & 2 deletions blockchain/blockgenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ type BlockGenerator struct {
}

// SetCoinbase sets the coinbase of the generated block.
func (bg *BlockGenerator) SetCoinbase(addr common.Name) {
func (bg *BlockGenerator) SetCoinbase(name common.Name) {
if bg.gasPool != nil {
if len(bg.txs) > 0 {
panic("coinbase must be set before adding transactions")
}
panic("coinbase can only be set once")
}
bg.header.Coinbase = addr
bg.header.Coinbase = name
bg.gasPool = new(common.GasPool).AddGas(bg.header.GasLimit)
}

Expand Down
16 changes: 8 additions & 8 deletions blockchain/forkcontroller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ func TestForkController(t *testing.T) {
}
fc := NewForkController(testcfg, params.DefaultChainconfig)

var height int64
var number int64
for j := 0; j < 2; j++ {
for i := 0; i < 8; i++ {

block := &types.Block{Head: &types.Header{Number: big.NewInt(height)}}
block := &types.Block{Head: &types.Header{Number: big.NewInt(number)}}
block.Head.WithForkID(uint64(j), uint64(j+1))
assert.NoError(t, fc.checkForkID(block.Header(), statedb))
assert.NoError(t, fc.update(block, statedb))
height++
number++
}

for i := 0; i < 10; i++ {
block := &types.Block{Head: &types.Header{Number: big.NewInt(height)}}
block := &types.Block{Head: &types.Header{Number: big.NewInt(number)}}
block.Head.WithForkID(uint64(j+1), uint64(j+1))
assert.NoError(t, fc.checkForkID(block.Header(), statedb))
assert.NoError(t, fc.update(block, statedb))
height++
number++
}

id, _, err := fc.currentForkID(statedb)
Expand All @@ -77,14 +77,14 @@ func TestUpdateDifferentForkBlock(t *testing.T) {
}

fc := NewForkController(testcfg, params.DefaultChainconfig)
var height int64
var number int64
for j := 0; j < 2; j++ {
for i := 0; i < 7; i++ {
block := &types.Block{Head: &types.Header{Number: big.NewInt(height)}}
block := &types.Block{Head: &types.Header{Number: big.NewInt(number)}}
block.Head.WithForkID(uint64(0), uint64(j+1))
assert.NoError(t, fc.checkForkID(block.Header(), statedb))
assert.NoError(t, fc.update(block, statedb))
height++
number++

info, err := fc.getForkInfo(statedb)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions blockchain/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ func SetupGenesisBlock(db fdb.Database, genesis *Genesis) (chainCfg *params.Chai
}
newcfg := genesis.configOrDefault(stored)

height := rawdb.ReadHeaderNumber(db, rawdb.ReadHeadHeaderHash(db))
if height == nil {
number := rawdb.ReadHeaderNumber(db, rawdb.ReadHeadHeaderHash(db))
if number == nil {
return newcfg, dposConfig(newcfg), common.Hash{}, fmt.Errorf("missing block number for head header hash")
}

Expand Down Expand Up @@ -353,7 +353,7 @@ func (g *Genesis) ToBlock(db fdb.Database) (*types.Block, []*types.Receipt) {
URL: candidate.URL,
Quantity: big.NewInt(0),
TotalQuantity: big.NewInt(0),
Height: number.Uint64(),
Number: number.Uint64(),
}); err != nil {
panic(fmt.Sprintf("genesis create candidate err %v", err))
}
Expand Down
2 changes: 0 additions & 2 deletions build/eg_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ log:
node:
# the node datadir
datadir: "./build/testdatadir"
# Reduce key-derivation RAM & CPU usage at some expense of KDF strength
lightkdf: false
# RPC:ipc file name
ipcpath: "ft.ipc"
# RPC:http host address
Expand Down
Loading

0 comments on commit 733b103

Please sign in to comment.