Documentation ¶
Index ¶
- Variables
- func BitMapBit(bitmap []byte, index uint32) bool
- func CalcBitMap(ori, cur [][]byte, data []*types.ReceiptData) []byte
- func CalcSubBitMap(ori, sub [][]byte, data []*types.ReceiptData) []byte
- func CheckBlock(client queue.Client, block *types.BlockDetail) error
- func CheckFileExists(fileName string) (bool, error)
- func CheckFileIsExist(filename string) bool
- func CheckPathExisted(path string) bool
- func CheckTxDup(client queue.Client, txs []*types.TransactionCache, height int64) (transactions []*types.TransactionCache, err error)
- func CopyFile(srcFile, dstFile string) (written int64, err error)
- func CreateCoinsTx(priv crypto.PrivKey, to string, amount int64) *types.Transaction
- func CreateManageTx(priv crypto.PrivKey, key, op, value string) *types.Transaction
- func CreateNewBlock(parent *types.Block, txs []*types.Transaction) *types.Block
- func CreateNoneBlock(priv crypto.PrivKey, n int64) *types.Block
- func CreateNoneTx(priv crypto.PrivKey) *types.Transaction
- func CreateTxWithExecer(priv crypto.PrivKey, execer string) *types.Transaction
- func CreateTxWithTxHeight(priv crypto.PrivKey, to string, amount, expire int64) *types.Transaction
- func DeleteFile(fileName string) error
- func DirEmpty(path string) (bool, error)
- func DirExists(path string) (bool, error)
- func ExecAndCheckBlock(qclient queue.Client, block *types.Block, txs []*types.Transaction, status int) (*types.Block, error)
- func ExecAndCheckBlock2(qclient queue.Client, block *types.Block, txs []*types.Transaction, ...) (*types.Block, error)
- func ExecAndCheckBlockCB(qclient queue.Client, block *types.Block, txs []*types.Transaction, ...) (*types.Block, error)
- func ExecBlock(client queue.Client, prevStateRoot []byte, block *types.Block, errReturn bool, ...) (*types.BlockDetail, []*types.Transaction, error)
- func ExecKVMemSet(client queue.Client, prevStateRoot []byte, height int64, ...) []byte
- func ExecKVSetCommit(client queue.Client, hash []byte) error
- func ExecKVSetRollback(client queue.Client, hash []byte) error
- func ExecTx(client queue.Client, prevStateRoot []byte, block *types.Block) *types.Receipts
- func GenCoinsTxs(priv crypto.PrivKey, n int64) (txs []*types.Transaction)
- func GenNoneTxs(priv crypto.PrivKey, n int64) (txs []*types.Transaction)
- func GenTxsTxHeigt(priv crypto.PrivKey, n, height int64) (txs []*types.Transaction)
- func Genaddress() (string, crypto.PrivKey)
- func GetParaExecName(paraName string, name string) string
- func HexToPrivkey(key string) crypto.PrivKey
- func JSONPrint(t *testing.T, input interface{})
- func MakeDir(path string) error
- func MakeStringToLower(in string, pos, count int) (out string, err error)
- func MakeStringToUpper(in string, pos, count int) (out string, err error)
- func OpenFile(fileName string) (*os.File, error)
- func Pwd() string
- func ReadFile(file string) ([]byte, error)
- func ReportErrEventToFront(logger log.Logger, client queue.Client, frommodule string, tomodule string, ...)
- func WriteStringToFile(file, content string) (writeLen int, err error)
Constants ¶
This section is empty.
Variables ¶
var TestPrivkeyHex = []string{
"4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01",
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944",
"B0BB75BC49A787A71F4834DA18614763B53A18291ECE6B5EDEC3AD19D150C3E7",
"56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138",
"2AFF1981291355322C7A6308D46A9C9BA311AA21D94F36B43FC6A6021A1334CF",
"2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989",
}
TestPrivkeyHex :
var TestPrivkeyList = []crypto.PrivKey{ HexToPrivkey("4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"), HexToPrivkey("CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"), HexToPrivkey("B0BB75BC49A787A71F4834DA18614763B53A18291ECE6B5EDEC3AD19D150C3E7"), HexToPrivkey("56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138"), HexToPrivkey("2AFF1981291355322C7A6308D46A9C9BA311AA21D94F36B43FC6A6021A1334CF"), HexToPrivkey("2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989"), }
TestPrivkeyList :
Functions ¶
func CalcBitMap ¶
func CalcBitMap(ori, cur [][]byte, data []*types.ReceiptData) []byte
CalcBitMap big-end mode, that is bytes [0] [1]
tx index: fedcba98 76543210
cur is subset of ori, receipts are align with cur txs, if the tx ty is OK in cur, find the tx in ori and set the index to 1, this function return ori's bitmap if all tx failed, the setBit will normalize result and just return nil slice
func CalcSubBitMap ¶
func CalcSubBitMap(ori, sub [][]byte, data []*types.ReceiptData) []byte
CalcSubBitMap : cur is subset of ori, data are align with ori, this function return cur's bitmap if all tx failed, the setBit will normalize result and just return nil slice
func CheckBlock ¶
func CheckBlock(client queue.Client, block *types.BlockDetail) error
CheckBlock : To check the block's validaty
func CheckFileExists ¶
CheckFileExists : check file exists or not
func CheckFileIsExist ¶
CheckFileIsExist : check whether the file exists or not
func CheckPathExisted ¶
CheckPathExisted : check the path exists or not
func CheckTxDup ¶
func CheckTxDup(client queue.Client, txs []*types.TransactionCache, height int64) (transactions []*types.TransactionCache, err error)
CheckTxDup : check whether the tx is duplicated within the while chain
func CreateCoinsTx ¶
CreateCoinsTx : Create Coins Tx
func CreateManageTx ¶
func CreateManageTx(priv crypto.PrivKey, key, op, value string) *types.Transaction
CreateManageTx : Create Manage Tx
func CreateNewBlock ¶
CreateNewBlock : Create a New Block
func CreateNoneBlock ¶
CreateNoneBlock : Create None Block
func CreateNoneTx ¶
func CreateNoneTx(priv crypto.PrivKey) *types.Transaction
CreateNoneTx : Create None Tx
func CreateTxWithExecer ¶
func CreateTxWithExecer(priv crypto.PrivKey, execer string) *types.Transaction
CreateTxWithExecer : Create Tx With Execer
func CreateTxWithTxHeight ¶
CreateTxWithTxHeight : Create Tx With Tx Height
func ExecAndCheckBlock ¶
func ExecAndCheckBlock(qclient queue.Client, block *types.Block, txs []*types.Transaction, status int) (*types.Block, error)
ExecAndCheckBlock : Exec and Check Block
func ExecAndCheckBlock2 ¶
func ExecAndCheckBlock2(qclient queue.Client, block *types.Block, txs []*types.Transaction, result []int) (*types.Block, error)
ExecAndCheckBlock2 :
func ExecAndCheckBlockCB ¶
func ExecAndCheckBlockCB(qclient queue.Client, block *types.Block, txs []*types.Transaction, cb func(int, *types.ReceiptData) error) (*types.Block, error)
ExecAndCheckBlockCB :
func ExecBlock ¶
func ExecBlock(client queue.Client, prevStateRoot []byte, block *types.Block, errReturn bool, sync bool) (*types.BlockDetail, []*types.Transaction, error)
ExecBlock : just exec block
func ExecKVMemSet ¶
func ExecKVMemSet(client queue.Client, prevStateRoot []byte, height int64, kvset []*types.KeyValue, sync bool) []byte
ExecKVMemSet : send kv values to memory store and set it in db
func ExecKVSetCommit ¶
ExecKVSetCommit : commit the data set opetation to db
func ExecKVSetRollback ¶
ExecKVSetRollback : do the db's roll back operation
func GenCoinsTxs ¶
func GenCoinsTxs(priv crypto.PrivKey, n int64) (txs []*types.Transaction)
GenCoinsTxs : generate txs to be executed on exector coin
func GenNoneTxs ¶
func GenNoneTxs(priv crypto.PrivKey, n int64) (txs []*types.Transaction)
GenNoneTxs : 创建一些 none 执行器的 交易列表,一般用于测试
func GenTxsTxHeigt ¶
func GenTxsTxHeigt(priv crypto.PrivKey, n, height int64) (txs []*types.Transaction)
GenTxsTxHeigt : Gen Txs with Heigt
func GetParaExecName ¶
GetParaExecName : 如果 name 没有 paraName 前缀,那么加上这个前缀
func HexToPrivkey ¶
HexToPrivkey : convert hex string to private key
func MakeStringToLower ¶
MakeStringToLower : 将给定的in字符串从pos开始一共count个转换为小写字母
func MakeStringToUpper ¶
MakeStringToUpper : 将给定的in字符串从pos开始一共count个转换为大写字母
func ReportErrEventToFront ¶
func ReportErrEventToFront(logger log.Logger, client queue.Client, frommodule string, tomodule string, err error)
ReportErrEventToFront 上报指定错误信息到指定模块,目前只支持从store,blockchain,wallet写数据库失败时上报错误信息到wallet模块, 然后由钱包模块前端定时调用显示给客户
func WriteStringToFile ¶
WriteStringToFile : write content to file
Types ¶
This section is empty.