Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
share
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张振华
share
Commits
aebe12b7
Commit
aebe12b7
authored
Nov 09, 2018
by
张振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
d6911cab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
查询地址在所有合约中代币余额的需求.md
查询地址在所有合约中代币余额的需求.md
+9
-3
No files found.
查询地址在所有合约中代币余额的需求.md
View file @
aebe12b7
...
...
@@ -48,6 +48,7 @@ ReplyGetExecBalance.IterateExecBalanceByStateHash中的处理逻辑如下:
由于存储合约余额的格式中,用户地址在后,变化的合约地址在前,导致处理上不是很直接,避免不了遍历所有合约及用户地址,在性能上需要注意。
</font>
附:主要的代码逻辑:
func (t *ReplyGetExecBalance) IterateExecBalanceByStateHash(key, value []byte) bool {
//合法的key例子:mavl-coins-bty-exec-16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp:1JmFaA6unrCFYEWPGRi7uuXY1KthTJxJEP
...
...
@@ -100,4 +101,9 @@ ReplyGetExecBalance.IterateExecBalanceByStateHash中的处理逻辑如下:
item := &ExecBalanceItem{execAddr, acc.Frozen, acc.Balance}
t.Items = append(t.Items, item)
}
\ No newline at end of file
}
附:相关UT用例:
TestIterateRangeForExecBalance 所在文件mavl_test.go
TestIterateExecBalanceByStateHash_PrefixWithoutExecAddr 所在文件types_test.go
TestIterateExecBalanceByStateHash_PrefixWithExecAddr 所在文件types_test.go
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment