From 51f6b6d33f5b50e16f0b04bcccd03ad370f36636 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 16 Jan 2017 10:20:20 +0100 Subject: [PATCH 1/4] common/hexutil: fix EncodeBig, Big.MarshalJSON The code was too clever and failed to include zeros on a big.Word boundary. --- common/hexutil/hexutil.go | 7 +------ common/hexutil/hexutil_test.go | 1 + common/hexutil/json.go | 9 ++------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/common/hexutil/hexutil.go b/common/hexutil/hexutil.go index 29e6de3335..4ec0ee8e62 100644 --- a/common/hexutil/hexutil.go +++ b/common/hexutil/hexutil.go @@ -169,12 +169,7 @@ func EncodeBig(bigint *big.Int) string { if nbits == 0 { return "0x0" } - enc := make([]byte, 2, (nbits/8)*2+2) - copy(enc, "0x") - for i := len(bigint.Bits()) - 1; i >= 0; i-- { - enc = strconv.AppendUint(enc, uint64(bigint.Bits()[i]), 16) - } - return string(enc) + return fmt.Sprintf("0x%x", bigint) } func has0xPrefix(input string) bool { diff --git a/common/hexutil/hexutil_test.go b/common/hexutil/hexutil_test.go index b58b4745c5..324e9d3481 100644 --- a/common/hexutil/hexutil_test.go +++ b/common/hexutil/hexutil_test.go @@ -46,6 +46,7 @@ var ( {referenceBig("1"), "0x1"}, {referenceBig("ff"), "0xff"}, {referenceBig("112233445566778899aabbccddeeff"), "0x112233445566778899aabbccddeeff"}, + {referenceBig("80a7f2c1bcc396c00"), "0x80a7f2c1bcc396c00"}, } encodeUint64Tests = []marshalTest{ diff --git a/common/hexutil/json.go b/common/hexutil/json.go index c36d862b5e..7e4736dd68 100644 --- a/common/hexutil/json.go +++ b/common/hexutil/json.go @@ -109,13 +109,8 @@ func (b *Big) MarshalJSON() ([]byte, error) { if nbits == 0 { return jsonZero, nil } - enc := make([]byte, 3, (nbits/8)*2+4) - copy(enc, `"0x`) - for i := len(bigint.Bits()) - 1; i >= 0; i-- { - enc = strconv.AppendUint(enc, uint64(bigint.Bits()[i]), 16) - } - enc = append(enc, '"') - return enc, nil + enc := fmt.Sprintf(`"0x%x"`, bigint) + return []byte(enc), nil } // UnmarshalJSON implements json.Unmarshaler. From 0fa9a8929c8a55d1b624479cead2bb960ada7cfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felf=C3=B6ldi=20Zsolt?= Date: Mon, 16 Jan 2017 10:51:29 +0100 Subject: [PATCH 2/4] les: fixed transaction sending deadlock (#3568) --- les/txrelay.go | 1 - 1 file changed, 1 deletion(-) diff --git a/les/txrelay.go b/les/txrelay.go index 84d049b45d..76d416c57a 100644 --- a/les/txrelay.go +++ b/les/txrelay.go @@ -110,7 +110,6 @@ func (self *LesTxRelay) send(txs types.Transactions, count int) { for p, list := range sendTo { cost := p.GetRequestCost(SendTxMsg, len(list)) go func(p *peer, list types.Transactions, cost uint64) { - p.fcServer.SendRequest(0, cost) p.SendTxs(cost, list) }(p, list, cost) } From da2a22c384a9b621ec853fe4b1aa651d606cf42b Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 16 Jan 2017 10:57:02 +0100 Subject: [PATCH 3/4] params: stable 1.5.7 --- params/version.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/params/version.go b/params/version.go index 6eb920a21e..a75d5a3d10 100644 --- a/params/version.go +++ b/params/version.go @@ -19,10 +19,10 @@ package params import "fmt" const ( - VersionMajor = 1 // Major version component of the current release - VersionMinor = 5 // Minor version component of the current release - VersionPatch = 7 // Patch version component of the current release - VersionMeta = "unstable" // Version metadata to append to the version string + VersionMajor = 1 // Major version component of the current release + VersionMinor = 5 // Minor version component of the current release + VersionPatch = 7 // Patch version component of the current release + VersionMeta = "stable" // Version metadata to append to the version string ) // Version holds the textual version string. From 26d385c18b5eb003d9a69ff618c78acbe594db44 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 16 Jan 2017 11:12:50 +0100 Subject: [PATCH 4/4] params, VERSION: 1.5.8 unstable --- VERSION | 2 +- params/version.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index f01291b87f..1cc9c180e2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.7 +1.5.8 diff --git a/params/version.go b/params/version.go index a75d5a3d10..b60e105d56 100644 --- a/params/version.go +++ b/params/version.go @@ -19,10 +19,10 @@ package params import "fmt" const ( - VersionMajor = 1 // Major version component of the current release - VersionMinor = 5 // Minor version component of the current release - VersionPatch = 7 // Patch version component of the current release - VersionMeta = "stable" // Version metadata to append to the version string + VersionMajor = 1 // Major version component of the current release + VersionMinor = 5 // Minor version component of the current release + VersionPatch = 8 // Patch version component of the current release + VersionMeta = "unstable" // Version metadata to append to the version string ) // Version holds the textual version string.