github.com/turingchain2020/turingchain@v1.1.21/system/dapp/manage/executor/exec.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package executor
     6  
     7  import (
     8  	"github.com/turingchain2020/turingchain/common/address"
     9  	"github.com/turingchain2020/turingchain/system/dapp"
    10  	mty "github.com/turingchain2020/turingchain/system/dapp/manage/types"
    11  	"github.com/turingchain2020/turingchain/types"
    12  )
    13  
    14  func (c *Manage) checkAddress(addr string) error {
    15  	if dapp.IsDriverAddress(addr, c.GetHeight()) {
    16  		return nil
    17  	}
    18  	return address.CheckAddress(addr)
    19  }
    20  
    21  func (c *Manage) checkTxToAddress(tx *types.Transaction, index int) error {
    22  	return c.checkAddress(tx.GetRealToAddr())
    23  }
    24  
    25  // Exec_Modify modify exec
    26  func (c *Manage) Exec_Modify(manageAction *types.ModifyConfig, tx *types.Transaction, index int) (*types.Receipt, error) {
    27  	clog.Info("manage.Exec", "start index", index)
    28  	// 兼容在区块上没有To地址检查的交易数据
    29  	types.AssertConfig(c.GetAPI())
    30  	cfg := c.GetAPI().GetConfig()
    31  	if cfg.IsDappFork(c.GetHeight(), mty.ManageX, "ForkManageExec") {
    32  		if err := c.checkTxToAddress(tx, index); err != nil {
    33  			return nil, err
    34  		}
    35  	}
    36  	action := NewAction(c, tx)
    37  	return action.modifyConfig(manageAction)
    38  
    39  }