github.com/turingchain2020/turingchain@v1.1.21/system/dapp/manage/executor/exec_local.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  	pty "github.com/turingchain2020/turingchain/system/dapp/manage/types"
     9  	"github.com/turingchain2020/turingchain/types"
    10  )
    11  
    12  // ExecLocal_Modify defines execlocal modify func
    13  func (c *Manage) ExecLocal_Modify(transfer *types.ModifyConfig, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
    14  	set := &types.LocalDBSet{}
    15  	for i := 0; i < len(receipt.Logs); i++ {
    16  		item := receipt.Logs[i]
    17  		if item.Ty == pty.ManageActionModifyConfig {
    18  			var receipt types.ReceiptConfig
    19  			err := types.Decode(item.Log, &receipt)
    20  			if err != nil {
    21  				panic(err) //数据错误了,已经被修改了
    22  			}
    23  			key := receipt.Current.Key
    24  			set.KV = append(set.KV, &types.KeyValue{Key: localKey(key), Value: types.Encode(receipt.Current)})
    25  			clog.Debug("ExecLocal to savelogs", "config ", key, "value", receipt.Current)
    26  		}
    27  	}
    28  	return set, nil
    29  }