Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
dc864ee3
Commit
dc864ee3
authored
Mar 16, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ToString methods
parent
f486c0ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
types.go
common/types.go
+6
-3
No files found.
common/types.go
View file @
dc864ee3
...
...
@@ -24,19 +24,22 @@ func (h Hash) SetBytes(b []byte) {
}
}
func
(
h
Hash
)
SetString
(
s
string
)
{
h
.
SetBytes
([]
byte
(
s
))
}
// Get the string representation of the underlying address
func
(
a
Address
)
Str
()
string
{
return
string
(
a
[
:
])
}
// Sets the address to the value of b. If b is larger than len(a) it will panic
func
(
h
Address
)
SetBytes
(
b
[]
byte
)
{
if
len
(
b
)
>
len
(
h
)
{
func
(
a
Address
)
SetBytes
(
b
[]
byte
)
{
if
len
(
b
)
>
len
(
a
)
{
panic
(
"unable to set bytes. too big"
)
}
// reverse loop
for
i
:=
len
(
b
);
i
>=
0
;
i
--
{
h
[
i
]
=
b
[
i
]
a
[
i
]
=
b
[
i
]
}
}
func
(
a
Address
)
SetString
(
s
string
)
{
h
.
SetBytes
([]
byte
(
a
))
}
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