Commit aebe12b7 authored by 张振华's avatar 张振华

modify

parent d6911cab
...@@ -48,6 +48,7 @@ ReplyGetExecBalance.IterateExecBalanceByStateHash中的处理逻辑如下: ...@@ -48,6 +48,7 @@ ReplyGetExecBalance.IterateExecBalanceByStateHash中的处理逻辑如下:
由于存储合约余额的格式中,用户地址在后,变化的合约地址在前,导致处理上不是很直接,避免不了遍历所有合约及用户地址,在性能上需要注意。 由于存储合约余额的格式中,用户地址在后,变化的合约地址在前,导致处理上不是很直接,避免不了遍历所有合约及用户地址,在性能上需要注意。
</font> </font>
附:主要的代码逻辑:
func (t *ReplyGetExecBalance) IterateExecBalanceByStateHash(key, value []byte) bool { func (t *ReplyGetExecBalance) IterateExecBalanceByStateHash(key, value []byte) bool {
//合法的key例子:mavl-coins-bty-exec-16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp:1JmFaA6unrCFYEWPGRi7uuXY1KthTJxJEP //合法的key例子:mavl-coins-bty-exec-16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp:1JmFaA6unrCFYEWPGRi7uuXY1KthTJxJEP
...@@ -100,4 +101,9 @@ ReplyGetExecBalance.IterateExecBalanceByStateHash中的处理逻辑如下: ...@@ -100,4 +101,9 @@ ReplyGetExecBalance.IterateExecBalanceByStateHash中的处理逻辑如下:
item := &ExecBalanceItem{execAddr, acc.Frozen, acc.Balance} item := &ExecBalanceItem{execAddr, acc.Frozen, acc.Balance}
t.Items = append(t.Items, item) 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment