chainmaker_tools

package
v0.0.0-...-f30a169 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package utils defines tools for ChainMaker spv

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcDagHash

func CalcDagHash(hashType string, dag *cmCommonPb.DAG) ([]byte, error)

CalcDagHash calculate DAG hash

func CalcRWSetRoot

func CalcRWSetRoot(hashType string, txs []*cmCommonPb.Transaction) ([]byte, error)

CalcRWSetRoot calculate txs' read-write set root hash, following the tx order in txs

func CalcTxHash

func CalcTxHash(transaction *cmCommonPb.Transaction) ([]byte, error)

CalcTxHash calculate transaction hash

func TxRequestConverter

func TxRequestConverter(request *cm_pbgo.TxRequest) (*cmCommonPb.TxRequest, error)

TxRequestConverter converts *cm_pbgo.TxRequest to *cmCommonPb.TxRequest

func TxResponseConverter

func TxResponseConverter(response *cmCommonPb.TxResponse) (*cm_pbgo.TxResponse, error)

TxResponseConverter converts *cmCommonPb.TxResponse to *cm_pbgo.TxResponse

Types

type ContractInfo

type ContractInfo struct {
	ContractName string
	Method       string
	Parameters   []interface{}
}

ContractInfo contains contract data in the block

func GetContractInfoByTxPayload

func GetContractInfoByTxPayload(transaction *cmCommonPb.Transaction) (*ContractInfo, error)

GetContractInfoByTxPayload parses RequestPayload in the Transaction to generate ContractInfo which contains contract name、method and params

func NewContractInfo

func NewContractInfo(name, method string, params []*cmCommonPb.KeyValuePair) *ContractInfo

NewContractInfo creates ContractInfo by contract name、contract method and contract params

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL