Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
30cc1c3b
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
30cc1c3b
编写于
5月 23, 2017
作者:
N
Nicolas Guillaume
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mobile: Add management methods to {Addresses,Topics,Hashes} structures
上级
da636c53
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
60 addition
and
0 deletion
+60
-0
mobile/common.go
mobile/common.go
+43
-0
mobile/ethereum.go
mobile/ethereum.go
+17
-0
未找到文件。
mobile/common.go
浏览文件 @
30cc1c3b
...
...
@@ -89,6 +89,18 @@ func (h *Hash) GetHex() string {
// Hashes represents a slice of hashes.
type
Hashes
struct
{
hashes
[]
common
.
Hash
}
// NewHashes creates a slice of uninitialized Hashes.
func
NewHashes
(
size
int
)
*
Hashes
{
return
&
Hashes
{
hashes
:
make
([]
common
.
Hash
,
size
),
}
}
// NewHashesEmpty creates an empty slice of Hashes values.
func
NewHashesEmpty
()
*
Hashes
{
return
NewHashes
(
0
)
}
// Size returns the number of hashes in the slice.
func
(
h
*
Hashes
)
Size
()
int
{
return
len
(
h
.
hashes
)
...
...
@@ -102,6 +114,20 @@ func (h *Hashes) Get(index int) (hash *Hash, _ error) {
return
&
Hash
{
h
.
hashes
[
index
]},
nil
}
// Set sets the Hash at the given index in the slice.
func
(
h
*
Hashes
)
Set
(
index
int
,
hash
*
Hash
)
error
{
if
index
<
0
||
index
>=
len
(
h
.
hashes
)
{
return
errors
.
New
(
"index out of bounds"
)
}
h
.
hashes
[
index
]
=
hash
.
hash
return
nil
}
// Append adds a new Hash element to the end of the slice.
func
(
h
*
Hashes
)
Append
(
hash
*
Hash
)
{
h
.
hashes
=
append
(
h
.
hashes
,
hash
.
hash
)
}
// Address represents the 20 byte address of an Ethereum account.
type
Address
struct
{
address
common
.
Address
...
...
@@ -164,6 +190,18 @@ func (a *Address) GetHex() string {
// Addresses represents a slice of addresses.
type
Addresses
struct
{
addresses
[]
common
.
Address
}
// NewAddresses creates a slice of uninitialized addresses.
func
NewAddresses
(
size
int
)
*
Addresses
{
return
&
Addresses
{
addresses
:
make
([]
common
.
Address
,
size
),
}
}
// NewAddressesEmpty creates an empty slice of Addresses values.
func
NewAddressesEmpty
()
*
Addresses
{
return
NewAddresses
(
0
)
}
// Size returns the number of addresses in the slice.
func
(
a
*
Addresses
)
Size
()
int
{
return
len
(
a
.
addresses
)
...
...
@@ -185,3 +223,8 @@ func (a *Addresses) Set(index int, address *Address) error {
a
.
addresses
[
index
]
=
address
.
address
return
nil
}
// Append adds a new address element to the end of the slice.
func
(
a
*
Addresses
)
Append
(
address
*
Address
)
{
a
.
addresses
=
append
(
a
.
addresses
,
address
.
address
)
}
mobile/ethereum.go
浏览文件 @
30cc1c3b
...
...
@@ -87,6 +87,18 @@ func (p *SyncProgress) GetKnownStates() int64 { return int64(p.progress.KnownS
// Topics is a set of topic lists to filter events with.
type
Topics
struct
{
topics
[][]
common
.
Hash
}
// NewTopics creates a slice of uninitialized Topics.
func
NewTopics
(
size
int
)
*
Topics
{
return
&
Topics
{
topics
:
make
([][]
common
.
Hash
,
size
),
}
}
// NewTopicsEmpty creates an empty slice of Topics values.
func
NewTopicsEmpty
()
*
Topics
{
return
NewTopics
(
0
)
}
// Size returns the number of topic lists inside the set
func
(
t
*
Topics
)
Size
()
int
{
return
len
(
t
.
topics
)
...
...
@@ -109,6 +121,11 @@ func (t *Topics) Set(index int, topics *Hashes) error {
return
nil
}
// Append adds a new topic list to the end of the slice.
func
(
t
*
Topics
)
Append
(
topics
*
Hashes
)
{
t
.
topics
=
append
(
t
.
topics
,
topics
.
hashes
)
}
// FilterQuery contains options for contact log filtering.
type
FilterQuery
struct
{
query
ethereum
.
FilterQuery
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录