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
cd52ef31
Commit
cd52ef31
authored
10 years ago
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Hex methods
parent
142e8125
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
types.go
common/types.go
+2
-0
No files found.
common/types.go
View file @
cd52ef31
...
...
@@ -27,6 +27,7 @@ func HexToHash(s string) Hash { return BytesToHash(FromHex(s)) }
func
(
h
Hash
)
Str
()
string
{
return
string
(
h
[
:
])
}
func
(
h
Hash
)
Bytes
()
[]
byte
{
return
h
[
:
]
}
func
(
h
Hash
)
Big
()
*
big
.
Int
{
return
Bytes2Big
(
h
[
:
])
}
func
(
h
Hash
)
Hex
()
string
{
return
"0x"
+
Bytes2Hex
(
h
[
:
])
}
// Sets the hash to the value of b. If b is larger than len(h) it will panic
func
(
h
*
Hash
)
SetBytes
(
b
[]
byte
)
{
...
...
@@ -65,6 +66,7 @@ func (a Address) Str() string { return string(a[:]) }
func
(
a
Address
)
Bytes
()
[]
byte
{
return
a
[
:
]
}
func
(
a
Address
)
Big
()
*
big
.
Int
{
return
Bytes2Big
(
a
[
:
])
}
func
(
a
Address
)
Hash
()
Hash
{
return
BytesToHash
(
a
[
:
])
}
func
(
a
Address
)
Hex
()
string
{
return
"0x"
+
Bytes2Hex
(
a
[
:
])
}
// Sets the address to the value of b. If b is larger than len(a) it will panic
func
(
a
*
Address
)
SetBytes
(
b
[]
byte
)
{
...
...
This diff is collapsed.
Click to expand it.
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