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
e7097641
Commit
e7097641
authored
May 29, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for namereg
parent
a2d01d6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
pub.go
ethpub/pub.go
+19
-1
No files found.
ethpub/pub.go
View file @
e7097641
...
...
@@ -2,8 +2,10 @@ package ethpub
import
(
"encoding/hex"
"fmt"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
"math/big"
"strings"
)
...
...
@@ -95,13 +97,29 @@ func (lib *PEthereum) Create(key, valueStr, gasStr, gasPriceStr, script string)
return
lib
.
createTx
(
key
,
""
,
valueStr
,
gasStr
,
gasPriceStr
,
script
)
}
var
namereg
=
ethutil
.
FromHex
(
"bb5f186604d057c1c5240ca2ae0f6430138ac010"
)
func
GetAddressFromNameReg
(
stateManager
*
ethchain
.
StateManager
,
name
string
)
[]
byte
{
recp
:=
new
(
big
.
Int
)
.
SetBytes
([]
byte
(
name
))
object
:=
stateManager
.
CurrentState
()
.
GetStateObject
(
namereg
)
reg
:=
object
.
GetStorage
(
recp
)
return
reg
.
Bytes
()
}
func
(
lib
*
PEthereum
)
createTx
(
key
,
recipient
,
valueStr
,
gasStr
,
gasPriceStr
,
scriptStr
string
)
(
*
PReceipt
,
error
)
{
var
hash
[]
byte
var
contractCreation
bool
if
len
(
recipient
)
==
0
{
contractCreation
=
true
}
else
{
hash
=
ethutil
.
FromHex
(
recipient
)
// Check if an address is stored by this address
addr
:=
GetAddressFromNameReg
(
lib
.
stateManager
,
recipient
)
if
len
(
addr
)
>
0
{
hash
=
addr
}
else
{
hash
=
ethutil
.
FromHex
(
recipient
)
}
}
var
keyPair
*
ethutil
.
KeyPair
...
...
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