aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-03-02 21:16:59 +0800
committerGitHub <noreply@github.com>2017-03-02 21:16:59 +0800
commit213b8f9af41aee0f0888818bceb500374409733d (patch)
treeee3823716e9d54aed875fd6d4c2ba43c5bd6dacd /core
parent9184249b393e4e332ae6a2f5d774880a88a9bfd6 (diff)
parent280f08be84325924ea7628a8187fd84e7cc39145 (diff)
downloadgo-tangerine-213b8f9af41aee0f0888818bceb500374409733d.tar.gz
go-tangerine-213b8f9af41aee0f0888818bceb500374409733d.tar.zst
go-tangerine-213b8f9af41aee0f0888818bceb500374409733d.zip
Merge pull request #3722 from fjl/hexutil-text-unmarshal
common/hexutil: implement TextMarshaler, TextUnmarshaler
Diffstat (limited to 'core')
-rw-r--r--core/types/block.go12
-rw-r--r--core/types/bloom9.go12
2 files changed, 12 insertions, 12 deletions
diff --git a/core/types/block.go b/core/types/block.go
index 1a2a1f2bd..1dae87962 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -62,14 +62,14 @@ func (n BlockNonce) Uint64() uint64 {
return binary.BigEndian.Uint64(n[:])
}
-// MarshalJSON implements json.Marshaler
-func (n BlockNonce) MarshalJSON() ([]byte, error) {
- return hexutil.Bytes(n[:]).MarshalJSON()
+// MarshalText encodes n as a hex string with 0x prefix.
+func (n BlockNonce) MarshalText() ([]byte, error) {
+ return hexutil.Bytes(n[:]).MarshalText()
}
-// UnmarshalJSON implements json.Unmarshaler
-func (n *BlockNonce) UnmarshalJSON(input []byte) error {
- return hexutil.UnmarshalJSON("BlockNonce", input, n[:])
+// UnmarshalText implements encoding.TextUnmarshaler.
+func (n *BlockNonce) UnmarshalText(input []byte) error {
+ return hexutil.UnmarshalFixedText("BlockNonce", input, n[:])
}
// Header represents a block header in the Ethereum blockchain.
diff --git a/core/types/bloom9.go b/core/types/bloom9.go
index 2a37b5977..60aacc301 100644
--- a/core/types/bloom9.go
+++ b/core/types/bloom9.go
@@ -75,14 +75,14 @@ func (b Bloom) TestBytes(test []byte) bool {
}
-// MarshalJSON encodes b as a hex string with 0x prefix.
-func (b Bloom) MarshalJSON() ([]byte, error) {
- return hexutil.Bytes(b[:]).MarshalJSON()
+// MarshalText encodes b as a hex string with 0x prefix.
+func (b Bloom) MarshalText() ([]byte, error) {
+ return hexutil.Bytes(b[:]).MarshalText()
}
-// UnmarshalJSON b as a hex string with 0x prefix.
-func (b *Bloom) UnmarshalJSON(input []byte) error {
- return hexutil.UnmarshalJSON("Bloom", input, b[:])
+// UnmarshalText b as a hex string with 0x prefix.
+func (b *Bloom) UnmarshalText(input []byte) error {
+ return hexutil.UnmarshalFixedText("Bloom", input, b[:])
}
func CreateBloom(receipts Receipts) Bloom {