core/types: remove String methods from struct types (#16205)
Most of these methods did not contain all the relevant information inside the object and were not using a similar formatting type. Moreover, the existence of a suboptimal String method breaks usage with more advanced data dumping tools like go-spew.
This commit is contained in:
committed by
Felix Lange
parent
1e248f3a6e
commit
ec8ee611ca
@ -97,12 +97,6 @@ func (h *Header) EncodeJSON() (string, error) {
|
||||
return string(data), err
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer interface to print some semi-meaningful
|
||||
// data dump of the header for debugging purposes.
|
||||
func (h *Header) String() string {
|
||||
return h.header.String()
|
||||
}
|
||||
|
||||
func (h *Header) GetParentHash() *Hash { return &Hash{h.header.ParentHash} }
|
||||
func (h *Header) GetUncleHash() *Hash { return &Hash{h.header.UncleHash} }
|
||||
func (h *Header) GetCoinbase() *Address { return &Address{h.header.Coinbase} }
|
||||
@ -174,12 +168,6 @@ func (b *Block) EncodeJSON() (string, error) {
|
||||
return string(data), err
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer interface to print some semi-meaningful
|
||||
// data dump of the block for debugging purposes.
|
||||
func (b *Block) String() string {
|
||||
return b.block.String()
|
||||
}
|
||||
|
||||
func (b *Block) GetParentHash() *Hash { return &Hash{b.block.ParentHash()} }
|
||||
func (b *Block) GetUncleHash() *Hash { return &Hash{b.block.UncleHash()} }
|
||||
func (b *Block) GetCoinbase() *Address { return &Address{b.block.Coinbase()} }
|
||||
@ -249,12 +237,6 @@ func (tx *Transaction) EncodeJSON() (string, error) {
|
||||
return string(data), err
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer interface to print some semi-meaningful
|
||||
// data dump of the transaction for debugging purposes.
|
||||
func (tx *Transaction) String() string {
|
||||
return tx.tx.String()
|
||||
}
|
||||
|
||||
func (tx *Transaction) GetData() []byte { return tx.tx.Data() }
|
||||
func (tx *Transaction) GetGas() int64 { return int64(tx.tx.Gas()) }
|
||||
func (tx *Transaction) GetGasPrice() *BigInt { return &BigInt{tx.tx.GasPrice()} }
|
||||
@ -347,12 +329,6 @@ func (r *Receipt) EncodeJSON() (string, error) {
|
||||
return string(data), err
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer interface to print some semi-meaningful
|
||||
// data dump of the transaction receipt for debugging purposes.
|
||||
func (r *Receipt) String() string {
|
||||
return r.receipt.String()
|
||||
}
|
||||
|
||||
func (r *Receipt) GetPostState() []byte { return r.receipt.PostState }
|
||||
func (r *Receipt) GetCumulativeGasUsed() int64 { return int64(r.receipt.CumulativeGasUsed) }
|
||||
func (r *Receipt) GetBloom() *Bloom { return &Bloom{r.receipt.Bloom} }
|
||||
|
Reference in New Issue
Block a user