mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-16 17:03:46 +00:00
Merge a6bfca5b18 into 2ab7fe8982
This commit is contained in:
commit
5b4d78c40c
1 changed files with 2 additions and 2 deletions
|
|
@ -90,7 +90,7 @@ func (h Hash) MarshalText() ([]byte, error) {
|
|||
|
||||
// Sets the hash to the value of b. If b is larger than len(h), 'b' will be cropped (from the left).
|
||||
func (h *Hash) SetBytes(b []byte) {
|
||||
if len(b) > len(h) {
|
||||
if len(b) > HashLength {
|
||||
b = b[len(b)-HashLength:]
|
||||
}
|
||||
|
||||
|
|
@ -200,7 +200,7 @@ func (a Address) Format(s fmt.State, c rune) {
|
|||
|
||||
// Sets the address to the value of b. If b is larger than len(a) it will panic
|
||||
func (a *Address) SetBytes(b []byte) {
|
||||
if len(b) > len(a) {
|
||||
if len(b) > AddressLength {
|
||||
b = b[len(b)-AddressLength:]
|
||||
}
|
||||
copy(a[AddressLength-len(b):], b)
|
||||
|
|
|
|||
Loading…
Reference in a new issue