Skip to content

Commit

Permalink
core: rename func
Browse files Browse the repository at this point in the history
  • Loading branch information
bibibong committed Jun 15, 2018
1 parent 46c7518 commit 62435ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions core/compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ func SetCompatibilityOptions(chainID uint32) {
NewNvmExeTimeoutConsumeGasHeight = LocalNewNvmExeTimeoutConsumeGasHeight
}

// sort V8JSLibVersionHeightSlice in descending order by height
sort.Sort(sort.Reverse(V8JSLibVersionHeightSlice))

logging.VLog().WithFields(logrus.Fields{
Expand Down Expand Up @@ -465,8 +466,9 @@ func init() {
}
}

// GetV8JSLibVersion ..
func GetV8JSLibVersion(blockHeight uint64) string {
// GetMaxV8JSLibVersionAtHeight ..
func GetMaxV8JSLibVersionAtHeight(blockHeight uint64) string {
// V8JSLibVersionHeightSlice is already sorted at SetCompatibilityOptions func
for _, v := range V8JSLibVersionHeightSlice {
if blockHeight >= v.height {
return v.version
Expand Down
2 changes: 1 addition & 1 deletion core/transaction_deploy_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (payload *DeployPayload) Execute(limitedGas *util.Uint128, tx *Transaction,
return util.NewUint128(), "", err
} */
var contract state.Account
v := GetV8JSLibVersion(block.Height())
v := GetMaxV8JSLibVersionAtHeight(block.Height())
if len(v) > 0 {
contract, err = ws.CreateContractAccount(addr.Bytes(), tx.Hash(), &corepb.ContractMeta{Version: v})
} else {
Expand Down

0 comments on commit 62435ca

Please sign in to comment.