mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
Change prefix to xdc
Add prefix to Str method of Address. Make jsre works.
This commit is contained in:
parent
6d7b0b3949
commit
9fb068a25a
1 changed files with 10 additions and 12 deletions
|
|
@ -30,11 +30,11 @@ import (
|
||||||
const (
|
const (
|
||||||
HashLength = 32
|
HashLength = 32
|
||||||
AddressLength = 20
|
AddressLength = 20
|
||||||
BlockSigners = "0x0000000000000000000000000000000000000089"
|
MasternodeVotingSMC = "xdc0000000000000000000000000000000000000088"
|
||||||
MasternodeVotingSMC = "0x0000000000000000000000000000000000000088"
|
BlockSigners = "xdc0000000000000000000000000000000000000089"
|
||||||
RandomizeSMC = "0x0000000000000000000000000000000000000090"
|
RandomizeSMC = "xdc0000000000000000000000000000000000000090"
|
||||||
FoudationAddr = "0x0000000000000000000000000000000000000068"
|
FoudationAddr = "xdc0000000000000000000000000000000000000068"
|
||||||
TeamAddr = "0x0000000000000000000000000000000000000099"
|
TeamAddr = "xdc0000000000000000000000000000000000000099"
|
||||||
VoteMethod = "0x6dd7d8ea"
|
VoteMethod = "0x6dd7d8ea"
|
||||||
UnvoteMethod = "0x02aa9be2"
|
UnvoteMethod = "0x02aa9be2"
|
||||||
ProposeMethod = "0x01267951"
|
ProposeMethod = "0x01267951"
|
||||||
|
|
@ -50,11 +50,6 @@ var (
|
||||||
// Hash represents the 32 byte Keccak256 hash of arbitrary data.
|
// Hash represents the 32 byte Keccak256 hash of arbitrary data.
|
||||||
type Hash [HashLength]byte
|
type Hash [HashLength]byte
|
||||||
|
|
||||||
type Vote struct {
|
|
||||||
Masternode Address
|
|
||||||
Voter Address
|
|
||||||
}
|
|
||||||
|
|
||||||
func BytesToHash(b []byte) Hash {
|
func BytesToHash(b []byte) Hash {
|
||||||
var h Hash
|
var h Hash
|
||||||
h.SetBytes(b)
|
h.SetBytes(b)
|
||||||
|
|
@ -165,6 +160,9 @@ func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
|
||||||
// IsHexAddress verifies whether a string can represent a valid hex-encoded
|
// IsHexAddress verifies whether a string can represent a valid hex-encoded
|
||||||
// Ethereum address or not.
|
// Ethereum address or not.
|
||||||
func IsHexAddress(s string) bool {
|
func IsHexAddress(s string) bool {
|
||||||
|
if hasXDCPrefix(s) {
|
||||||
|
s = s[3:]
|
||||||
|
}
|
||||||
if hasHexPrefix(s) {
|
if hasHexPrefix(s) {
|
||||||
s = s[2:]
|
s = s[2:]
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +194,7 @@ func (a Address) Hex() string {
|
||||||
result[i] -= 32
|
result[i] -= 32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "0x" + string(result)
|
return "xdc" + string(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
// String implements the stringer interface and is used also by the logger.
|
// String implements the stringer interface and is used also by the logger.
|
||||||
|
|
@ -230,7 +228,7 @@ func (a *Address) Set(other Address) {
|
||||||
|
|
||||||
// MarshalText returns the hex representation of a.
|
// MarshalText returns the hex representation of a.
|
||||||
func (a Address) MarshalText() ([]byte, error) {
|
func (a Address) MarshalText() ([]byte, error) {
|
||||||
return hexutil.Bytes(a[:]).MarshalText()
|
return hexutil.Bytes(a[:]).MarshalXDCText()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalText parses a hash in hex syntax.
|
// UnmarshalText parses a hash in hex syntax.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue