diff --git a/accounts/abi/bind/backend.go b/accounts/abi/bind/backend.go
index 4509e222d5231c189e46a5b86038ad1b1ccaa731..25b61928e12185e65112d400e06e32bc402c30fe 100644
--- a/accounts/abi/bind/backend.go
+++ b/accounts/abi/bind/backend.go
@@ -17,13 +17,13 @@
 package bind
 
 import (
+	"context"
 	"errors"
 	"math/big"
 
 	"github.com/ethereum/go-ethereum"
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/core/types"
-	"golang.org/x/net/context"
 )
 
 var (
diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go
index 2e6796de6041090ba76c8cabd4325a5cb8917a9b..2f5719c78341c4526b3abb8a26932d70a41b0ecd 100644
--- a/accounts/abi/bind/backends/simulated.go
+++ b/accounts/abi/bind/backends/simulated.go
@@ -17,6 +17,7 @@
 package backends
 
 import (
+	"context"
 	"errors"
 	"fmt"
 	"math/big"
@@ -34,7 +35,6 @@ import (
 	"github.com/ethereum/go-ethereum/event"
 	"github.com/ethereum/go-ethereum/params"
 	"github.com/ethereum/go-ethereum/pow"
-	"golang.org/x/net/context"
 )
 
 // Default chain configuration which sets homestead phase at block 0 (i.e. no frontier)
diff --git a/accounts/abi/bind/base.go b/accounts/abi/bind/base.go
index 93362d9e9af035af233e343695b9a647a6a9e3e2..b40bd65e802d4403461912a6c57caa07d9e86a61 100644
--- a/accounts/abi/bind/base.go
+++ b/accounts/abi/bind/base.go
@@ -17,6 +17,7 @@
 package bind
 
 import (
+	"context"
 	"errors"
 	"fmt"
 	"math/big"
@@ -26,7 +27,6 @@ import (
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/core/types"
 	"github.com/ethereum/go-ethereum/crypto"
-	"golang.org/x/net/context"
 )
 
 // SignerFn is a signer function callback when a contract requires a method to
diff --git a/accounts/abi/bind/util.go b/accounts/abi/bind/util.go
index 8348f69801c1da4263a76cf1fd18cf28b60d515a..d129993ca12f136f5d1862de963b95826c90ec51 100644
--- a/accounts/abi/bind/util.go
+++ b/accounts/abi/bind/util.go
@@ -17,13 +17,13 @@
 package bind
 
 import (
+	"context"
 	"fmt"
 	"time"
 
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/core/types"
 	"github.com/ethereum/go-ethereum/log"
-	"golang.org/x/net/context"
 )
 
 // WaitMined waits for tx to be mined on the blockchain.
diff --git a/accounts/abi/bind/util_test.go b/accounts/abi/bind/util_test.go
index f31dbfc298379f2fbcb6b6e33d677392a1678eb1..b37a69cfca99f772124d3865e7ada362e8e3baa4 100644
--- a/accounts/abi/bind/util_test.go
+++ b/accounts/abi/bind/util_test.go
@@ -17,6 +17,7 @@
 package bind_test
 
 import (
+	"context"
 	"math/big"
 	"testing"
 	"time"
@@ -27,7 +28,6 @@ import (
 	"github.com/ethereum/go-ethereum/core"
 	"github.com/ethereum/go-ethereum/core/types"
 	"github.com/ethereum/go-ethereum/crypto"
-	"golang.org/x/net/context"
 )
 
 var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
diff --git a/accounts/usbwallet/ledger_wallet.go b/accounts/usbwallet/ledger_wallet.go
index c3d0f0ac855c497220d8c6a7035a25b1a5537f4f..698e85f48b08c0e4167cd3831fd39107761589a1 100644
--- a/accounts/usbwallet/ledger_wallet.go
+++ b/accounts/usbwallet/ledger_wallet.go
@@ -21,6 +21,7 @@
 package usbwallet
 
 import (
+	"context"
 	"encoding/binary"
 	"encoding/hex"
 	"errors"
@@ -38,7 +39,6 @@ import (
 	"github.com/ethereum/go-ethereum/log"
 	"github.com/ethereum/go-ethereum/rlp"
 	"github.com/karalabe/hid"
-	"golang.org/x/net/context"
 )
 
 // Maximum time between wallet health checks to detect USB unplugs.
diff --git a/build/_vendor/src/golang.org/x/net/LICENSE b/build/_vendor/src/golang.org/x/net/LICENSE
deleted file mode 100644
index 6a66aea5eafe0ca6a688840c47219556c552488e..0000000000000000000000000000000000000000
--- a/build/_vendor/src/golang.org/x/net/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-   * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-   * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-   * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/build/ci-notes.md b/build/ci-notes.md
index 92e7c54d0a4d786468d2df644fd8f40d6245ae90..cd2ba8bb2ba0674c3cb1ecbcea9a20e8d9952217 100644
--- a/build/ci-notes.md
+++ b/build/ci-notes.md
@@ -1,18 +1,3 @@
-# Vendored Dependencies
-
-Dependencies are almost all vendored in at the standard Go `/vendor` path. This allows
-people to build go-ethereum using the standard toolchain without any particular package
-manager. It also plays nicely with `go get`, not requiring external code to be relied on.
-
-The one single dependent package missing from `vendor` is `golang.org/x/net/context`. As
-this is a package exposed via public library APIs, it must not be vendored as dependent
-code woulnd't be able to instantiate.
-
-To allow reproducible builds of go-ethereum nonetheless that don't need network access
-during build time to fetch `golang.org/x/net/context`, a version was copied into our repo
-at the very specific `/build/_vendor` path, which is added automatically by all CI build
-scripts and the makefile too.
-
 # Debian Packaging
 
 Tagged releases and develop branch commits are available as installable Debian packages
diff --git a/contracts/chequebook/cheque.go b/contracts/chequebook/cheque.go
index 945e56e863f4fe28353df2ac72019a36d2db2379..7e0f7eafc35e129b9df3920101bded32cfbd5ed2 100644
--- a/contracts/chequebook/cheque.go
+++ b/contracts/chequebook/cheque.go
@@ -26,6 +26,7 @@ package chequebook
 
 import (
 	"bytes"
+	"context"
 	"crypto/ecdsa"
 	"encoding/json"
 	"fmt"
@@ -43,7 +44,6 @@ import (
 	"github.com/ethereum/go-ethereum/crypto"
 	"github.com/ethereum/go-ethereum/log"
 	"github.com/ethereum/go-ethereum/swarm/services/swap/swap"
-	"golang.org/x/net/context"
 )
 
 // TODO(zelig): watch peer solvency and notify of bouncing cheques
diff --git a/contracts/release/release.go b/contracts/release/release.go
index 613e62aa9c2e69a77f1d47e3590828553e635253..28a35381d485f60e18d5605a3a821bcc2ba991ef 100644
--- a/contracts/release/release.go
+++ b/contracts/release/release.go
@@ -20,6 +20,7 @@ package release
 //go:generate abigen --sol ./contract.sol --pkg release --out ./contract.go
 
 import (
+	"context"
 	"fmt"
 	"strings"
 	"time"
@@ -33,7 +34,6 @@ import (
 	"github.com/ethereum/go-ethereum/node"
 	"github.com/ethereum/go-ethereum/p2p"
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 // Interval to check for new releases
@@ -116,47 +116,49 @@ func (r *ReleaseService) checker() {
 
 	for {
 		select {
-		// If the time arrived, check for a new release
 		case <-timer.C:
 			// Rechedule the timer before continuing
 			timer.Reset(releaseRecheckInterval)
-
-			// Retrieve the current version, and handle missing contracts gracefully
-			ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
-			opts := &bind.CallOpts{Context: ctx}
-			version, err := r.oracle.CurrentVersion(opts)
-			if err != nil {
-				if err == bind.ErrNoCode {
-					log.Debug("Release oracle not found", "contract", r.config.Oracle)
-					continue
-				}
-				log.Error("Failed to retrieve current release", "err", err)
-				continue
-			}
-			// Version was successfully retrieved, notify if newer than ours
-			if version.Major > r.config.Major ||
-				(version.Major == r.config.Major && version.Minor > r.config.Minor) ||
-				(version.Major == r.config.Major && version.Minor == r.config.Minor && version.Patch > r.config.Patch) {
-
-				warning := fmt.Sprintf("Client v%d.%d.%d-%x seems older than the latest upstream release v%d.%d.%d-%x",
-					r.config.Major, r.config.Minor, r.config.Patch, r.config.Commit[:4], version.Major, version.Minor, version.Patch, version.Commit[:4])
-				howtofix := fmt.Sprintf("Please check https://github.com/ethereum/go-ethereum/releases for new releases")
-				separator := strings.Repeat("-", len(warning))
-
-				log.Warn(separator)
-				log.Warn(warning)
-				log.Warn(howtofix)
-				log.Warn(separator)
-			} else {
-				log.Debug("Client seems up to date with upstream",
-					"local", fmt.Sprintf("v%d.%d.%d-%x", r.config.Major, r.config.Minor, r.config.Patch, r.config.Commit[:4]),
-					"upstream", fmt.Sprintf("v%d.%d.%d-%x", version.Major, version.Minor, version.Patch, version.Commit[:4]))
-			}
-
-		// If termination was requested, return
+			r.checkVersion()
 		case errc := <-r.quit:
 			errc <- nil
 			return
 		}
 	}
 }
+
+func (r *ReleaseService) checkVersion() {
+	// Retrieve the current version, and handle missing contracts gracefully
+	ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
+	opts := &bind.CallOpts{Context: ctx}
+	defer cancel()
+
+	version, err := r.oracle.CurrentVersion(opts)
+	if err != nil {
+		if err == bind.ErrNoCode {
+			log.Debug("Release oracle not found", "contract", r.config.Oracle)
+		} else {
+			log.Error("Failed to retrieve current release", "err", err)
+		}
+		return
+	}
+	// Version was successfully retrieved, notify if newer than ours
+	if version.Major > r.config.Major ||
+		(version.Major == r.config.Major && version.Minor > r.config.Minor) ||
+		(version.Major == r.config.Major && version.Minor == r.config.Minor && version.Patch > r.config.Patch) {
+
+		warning := fmt.Sprintf("Client v%d.%d.%d-%x seems older than the latest upstream release v%d.%d.%d-%x",
+			r.config.Major, r.config.Minor, r.config.Patch, r.config.Commit[:4], version.Major, version.Minor, version.Patch, version.Commit[:4])
+		howtofix := fmt.Sprintf("Please check https://github.com/ethereum/go-ethereum/releases for new releases")
+		separator := strings.Repeat("-", len(warning))
+
+		log.Warn(separator)
+		log.Warn(warning)
+		log.Warn(howtofix)
+		log.Warn(separator)
+	} else {
+		log.Debug("Client seems up to date with upstream",
+			"local", fmt.Sprintf("v%d.%d.%d-%x", r.config.Major, r.config.Minor, r.config.Patch, r.config.Commit[:4]),
+			"upstream", fmt.Sprintf("v%d.%d.%d-%x", version.Major, version.Minor, version.Patch, version.Commit[:4]))
+	}
+}
diff --git a/eth/api.go b/eth/api.go
index b17968ebb223436642195f7ab2d04dc9525bb41c..b64153fd72552084e3aaa1e7ad55958b1a711d87 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -19,6 +19,7 @@ package eth
 import (
 	"bytes"
 	"compress/gzip"
+	"context"
 	"errors"
 	"fmt"
 	"io"
@@ -39,7 +40,6 @@ import (
 	"github.com/ethereum/go-ethereum/miner"
 	"github.com/ethereum/go-ethereum/params"
 	"github.com/ethereum/go-ethereum/rlp"
-	"golang.org/x/net/context"
 )
 
 const defaultTraceTimeout = 5 * time.Second
diff --git a/eth/api_backend.go b/eth/api_backend.go
index bce772900d66d9a6c06f5b6ce79e4f2961504ea3..418a34435431dc1ee18091785184755f69833032 100644
--- a/eth/api_backend.go
+++ b/eth/api_backend.go
@@ -17,6 +17,7 @@
 package eth
 
 import (
+	"context"
 	"math/big"
 
 	"github.com/ethereum/go-ethereum/accounts"
@@ -33,7 +34,6 @@ import (
 	"github.com/ethereum/go-ethereum/internal/ethapi"
 	"github.com/ethereum/go-ethereum/params"
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 // EthApiBackend implements ethapi.Backend for full nodes
diff --git a/eth/bind.go b/eth/bind.go
index 2ee9f2bf7bc22bc72ea71cc84bb01718fb384bcb..2459341834996be75647d1467703120420c123db 100644
--- a/eth/bind.go
+++ b/eth/bind.go
@@ -17,6 +17,7 @@
 package eth
 
 import (
+	"context"
 	"math/big"
 
 	"github.com/ethereum/go-ethereum"
@@ -26,7 +27,6 @@ import (
 	"github.com/ethereum/go-ethereum/internal/ethapi"
 	"github.com/ethereum/go-ethereum/rlp"
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 // ContractBackend implements bind.ContractBackend with direct calls to Ethereum
diff --git a/eth/downloader/api.go b/eth/downloader/api.go
index e41376810f29d3e8893e7ae028d07fa2418df912..d496fa6a4d4fdb57ad986c532b8f3ca5e4bf8c35 100644
--- a/eth/downloader/api.go
+++ b/eth/downloader/api.go
@@ -17,12 +17,12 @@
 package downloader
 
 import (
+	"context"
 	"sync"
 
 	ethereum "github.com/ethereum/go-ethereum"
 	"github.com/ethereum/go-ethereum/event"
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 // PublicDownloaderAPI provides an API which gives information about the current synchronisation status.
diff --git a/eth/filters/api.go b/eth/filters/api.go
index 02a544ce1b313266b6e230b0544cb2d4bdace07f..61647a5d077a073d110990dc97e54c38fcbb174f 100644
--- a/eth/filters/api.go
+++ b/eth/filters/api.go
@@ -17,6 +17,7 @@
 package filters
 
 import (
+	"context"
 	"encoding/json"
 	"errors"
 	"fmt"
@@ -24,8 +25,6 @@ import (
 	"sync"
 	"time"
 
-	"golang.org/x/net/context"
-
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/common/hexutil"
 	"github.com/ethereum/go-ethereum/core/types"
diff --git a/eth/filters/filter.go b/eth/filters/filter.go
index 9a8e2fd70af30fc333a8de45e3aefd5101b942ed..0a0b81224ed520991aea23ad44522319731d528a 100644
--- a/eth/filters/filter.go
+++ b/eth/filters/filter.go
@@ -17,10 +17,10 @@
 package filters
 
 import (
+	"context"
 	"math"
-	"time"
-
 	"math/big"
+	"time"
 
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/core"
@@ -28,7 +28,6 @@ import (
 	"github.com/ethereum/go-ethereum/ethdb"
 	"github.com/ethereum/go-ethereum/event"
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 type Backend interface {
diff --git a/eth/filters/filter_system.go b/eth/filters/filter_system.go
index 3adf8111ad194513e2bb384624cbd25e95587f89..7abace1e6bf22f1db9d28894b62db962f51980ae 100644
--- a/eth/filters/filter_system.go
+++ b/eth/filters/filter_system.go
@@ -19,6 +19,7 @@
 package filters
 
 import (
+	"context"
 	"errors"
 	"fmt"
 	"sync"
@@ -29,7 +30,6 @@ import (
 	"github.com/ethereum/go-ethereum/core/types"
 	"github.com/ethereum/go-ethereum/event"
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 // Type determines the kind of filter and is used to put the filter in to
@@ -372,7 +372,8 @@ func (es *EventSystem) lightFilterNewHead(newHeader *types.Header, callBack func
 func (es *EventSystem) lightFilterLogs(header *types.Header, addresses []common.Address, topics [][]common.Hash, remove bool) []*types.Log {
 	if bloomFilter(header.Bloom, addresses, topics) {
 		// Get the logs of the block
-		ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
+		ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
+		defer cancel()
 		receipts, err := es.backend.GetReceipts(ctx, header.Hash())
 		if err != nil {
 			return nil
diff --git a/eth/filters/filter_system_test.go b/eth/filters/filter_system_test.go
index 1cfced7e4154817c2c0ab005108b5a87da598d2c..d9c245a85458ef01cece3512ae41837db7500df4 100644
--- a/eth/filters/filter_system_test.go
+++ b/eth/filters/filter_system_test.go
@@ -17,13 +17,12 @@
 package filters
 
 import (
+	"context"
 	"math/big"
 	"reflect"
 	"testing"
 	"time"
 
-	"golang.org/x/net/context"
-
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/core"
 	"github.com/ethereum/go-ethereum/core/types"
diff --git a/eth/filters/filter_test.go b/eth/filters/filter_test.go
index 83ff3e9ce0e885809e48de928c7847f2564bc821..c2dc2b842803694011afe107a4b1e1b1565cdcdf 100644
--- a/eth/filters/filter_test.go
+++ b/eth/filters/filter_test.go
@@ -17,13 +17,12 @@
 package filters
 
 import (
+	"context"
 	"io/ioutil"
 	"math/big"
 	"os"
 	"testing"
 
-	"golang.org/x/net/context"
-
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/core"
 	"github.com/ethereum/go-ethereum/core/types"
diff --git a/eth/gasprice/lightprice.go b/eth/gasprice/lightprice.go
index 8886d32d7dcef5476875f58fb9da6cf363d5ce48..562c7dd974be2b78d22cbdd1a9a45f056f0d82fe 100644
--- a/eth/gasprice/lightprice.go
+++ b/eth/gasprice/lightprice.go
@@ -17,6 +17,7 @@
 package gasprice
 
 import (
+	"context"
 	"math/big"
 	"sort"
 	"sync"
@@ -24,7 +25,6 @@ import (
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/internal/ethapi"
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 const (
diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go
index 1d04d9e0320ad5e77bb23da45c824995ff47250d..59f60d65989863a1d50fc20a05478e770a233190 100644
--- a/ethclient/ethclient.go
+++ b/ethclient/ethclient.go
@@ -18,6 +18,7 @@
 package ethclient
 
 import (
+	"context"
 	"encoding/json"
 	"fmt"
 	"math/big"
@@ -28,7 +29,6 @@ import (
 	"github.com/ethereum/go-ethereum/core/types"
 	"github.com/ethereum/go-ethereum/rlp"
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 // Client defines typed wrappers for the Ethereum RPC API.
diff --git a/event/subscription.go b/event/subscription.go
index 83bd21213d4544fd93bf2cd826738892954a712c..02d7b9d7d45c9a8e3cc55cf5ad75d43757ef22ed 100644
--- a/event/subscription.go
+++ b/event/subscription.go
@@ -17,11 +17,11 @@
 package event
 
 import (
+	"context"
 	"sync"
 	"time"
 
 	"github.com/ethereum/go-ethereum/common/mclock"
-	"golang.org/x/net/context"
 )
 
 // Subscription represents a stream of events. The carrier of the events is typically a
diff --git a/event/subscription_test.go b/event/subscription_test.go
index a4fe30298c0ca4f794ebbf35ce065dbffac959fc..aa6d98984db4b6856dfa7a07ab0c9fe0bdc75364 100644
--- a/event/subscription_test.go
+++ b/event/subscription_test.go
@@ -17,11 +17,10 @@
 package event
 
 import (
+	"context"
 	"errors"
 	"testing"
 	"time"
-
-	"golang.org/x/net/context"
 )
 
 var errInts = errors.New("error in subscribeInts")
diff --git a/interfaces.go b/interfaces.go
index f7e71a31732245154b780a6d346a6ad9dd79b848..744f07b95aa5743578ba07fe96674ad2fd286faa 100644
--- a/interfaces.go
+++ b/interfaces.go
@@ -18,12 +18,12 @@
 package ethereum
 
 import (
+	"context"
 	"errors"
 	"math/big"
 
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/core/types"
-	"golang.org/x/net/context"
 )
 
 // NotFound is returned by API methods if the requested item does not exist.
diff --git a/internal/build/util.go b/internal/build/util.go
index 1523a067bcc75db8963b77824a1d9e0a76bb1777..4df7b91381e51fa1bb2fddbaffe0d75d9ae408eb 100644
--- a/internal/build/util.go
+++ b/internal/build/util.go
@@ -52,19 +52,10 @@ func MustRunCommand(cmd string, args ...string) {
 // GOPATH returns the value that the GOPATH environment
 // variable should be set to.
 func GOPATH() string {
-	path := filepath.SplitList(os.Getenv("GOPATH"))
-	if len(path) == 0 {
+	if os.Getenv("GOPATH") == "" {
 		log.Fatal("GOPATH is not set")
 	}
-	// Ensure that our internal vendor folder is on GOPATH
-	vendor, _ := filepath.Abs(filepath.Join("build", "_vendor"))
-	for _, dir := range path {
-		if dir == vendor {
-			return strings.Join(path, string(filepath.ListSeparator))
-		}
-	}
-	newpath := append(path[:1], append([]string{vendor}, path[1:]...)...)
-	return strings.Join(newpath, string(filepath.ListSeparator))
+	return os.Getenv("GOPATH")
 }
 
 // VERSION returns the content of the VERSION file.
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index 0928c973f4049f3d453624b600f3c3d75cf2637c..ccb7ec80b1ca371c0adc95d2d66d2acf2f5603c2 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -18,6 +18,7 @@ package ethapi
 
 import (
 	"bytes"
+	"context"
 	"encoding/hex"
 	"errors"
 	"fmt"
@@ -43,7 +44,6 @@ import (
 	"github.com/ethereum/go-ethereum/rpc"
 	"github.com/syndtr/goleveldb/leveldb"
 	"github.com/syndtr/goleveldb/leveldb/util"
-	"golang.org/x/net/context"
 )
 
 const (
diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go
index e10fb14ffeeaaa01fa50d0ec8a4a1481ab737468..50cd3801b512a44473152c199251ac58f471cd1a 100644
--- a/internal/ethapi/backend.go
+++ b/internal/ethapi/backend.go
@@ -18,6 +18,7 @@
 package ethapi
 
 import (
+	"context"
 	"math/big"
 
 	"github.com/ethereum/go-ethereum/accounts"
@@ -30,7 +31,6 @@ import (
 	"github.com/ethereum/go-ethereum/event"
 	"github.com/ethereum/go-ethereum/params"
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 // Backend interface provides the common API services (that are provided by
diff --git a/les/api_backend.go b/les/api_backend.go
index 006240369c25a1cfd58f1649684b5324118f9561..df2782f78030e6bb611d878920abe3e38089761f 100644
--- a/les/api_backend.go
+++ b/les/api_backend.go
@@ -17,6 +17,7 @@
 package les
 
 import (
+	"context"
 	"math/big"
 
 	"github.com/ethereum/go-ethereum/accounts"
@@ -33,7 +34,6 @@ import (
 	"github.com/ethereum/go-ethereum/light"
 	"github.com/ethereum/go-ethereum/params"
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 type LesApiBackend struct {
diff --git a/les/odr.go b/les/odr.go
index 06b44d3186f1fd07f8cfaa07848cd01b1dc70b79..684f36c761dca1cc7998d7b70f7273e3f7f9b821 100644
--- a/les/odr.go
+++ b/les/odr.go
@@ -17,6 +17,7 @@
 package les
 
 import (
+	"context"
 	"crypto/rand"
 	"encoding/binary"
 	"sync"
@@ -26,7 +27,6 @@ import (
 	"github.com/ethereum/go-ethereum/ethdb"
 	"github.com/ethereum/go-ethereum/light"
 	"github.com/ethereum/go-ethereum/log"
-	"golang.org/x/net/context"
 )
 
 var (
diff --git a/les/odr_test.go b/les/odr_test.go
index 1b436b8e6ea7989a21d6c724c687b3ce0077a8f1..6b074f1a2259d48a5b9d91882d07fe1df68532d8 100644
--- a/les/odr_test.go
+++ b/les/odr_test.go
@@ -18,6 +18,7 @@ package les
 
 import (
 	"bytes"
+	"context"
 	"math/big"
 	"testing"
 	"time"
@@ -32,7 +33,6 @@ import (
 	"github.com/ethereum/go-ethereum/light"
 	"github.com/ethereum/go-ethereum/params"
 	"github.com/ethereum/go-ethereum/rlp"
-	"golang.org/x/net/context"
 )
 
 type odrTestFn func(ctx context.Context, db ethdb.Database, config *params.ChainConfig, bc *core.BlockChain, lc *light.LightChain, bhash common.Hash) []byte
@@ -181,8 +181,11 @@ func testOdr(t *testing.T, protocol int, expFail uint64, fn odrTestFn) {
 		for i := uint64(0); i <= pm.blockchain.CurrentHeader().Number.Uint64(); i++ {
 			bhash := core.GetCanonicalHash(db, i)
 			b1 := fn(light.NoOdr, db, pm.chainConfig, pm.blockchain.(*core.BlockChain), nil, bhash)
-			ctx, _ := context.WithTimeout(context.Background(), 200*time.Millisecond)
+
+			ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond)
+			defer cancel()
 			b2 := fn(ctx, ldb, lpm.chainConfig, nil, lpm.blockchain.(*light.LightChain), bhash)
+
 			eq := bytes.Equal(b1, b2)
 			exp := i < expFail
 			if exp && !eq {
diff --git a/les/request_test.go b/les/request_test.go
index bec6bf1bc1545f382588bd1a6050092c33494cce..ba1fc15bd741c949105cf70c30c88f5b3bcbd5bd 100644
--- a/les/request_test.go
+++ b/les/request_test.go
@@ -17,6 +17,7 @@
 package les
 
 import (
+	"context"
 	"testing"
 	"time"
 
@@ -25,7 +26,6 @@ import (
 	"github.com/ethereum/go-ethereum/crypto"
 	"github.com/ethereum/go-ethereum/ethdb"
 	"github.com/ethereum/go-ethereum/light"
-	"golang.org/x/net/context"
 )
 
 var testBankSecureTrieKey = secAddr(testBankAddress)
@@ -91,7 +91,9 @@ func testAccess(t *testing.T, protocol int, fn accessTestFn) {
 		for i := uint64(0); i <= pm.blockchain.CurrentHeader().Number.Uint64(); i++ {
 			bhash := core.GetCanonicalHash(db, i)
 			if req := fn(ldb, bhash, i); req != nil {
-				ctx, _ := context.WithTimeout(context.Background(), 200*time.Millisecond)
+				ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond)
+				defer cancel()
+
 				err := odr.Retrieve(ctx, req)
 				got := err == nil
 				exp := i < expFail
diff --git a/les/sync.go b/les/sync.go
index c143cb1453465d497862f5c34a1fccd1ae0f0ee8..c0e17f97d96b57e26b1a44cf935e74023bac8780 100644
--- a/les/sync.go
+++ b/les/sync.go
@@ -17,12 +17,12 @@
 package les
 
 import (
+	"context"
 	"time"
 
 	"github.com/ethereum/go-ethereum/core"
 	"github.com/ethereum/go-ethereum/eth/downloader"
 	"github.com/ethereum/go-ethereum/light"
-	"golang.org/x/net/context"
 )
 
 const (
@@ -77,8 +77,8 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
 		return
 	}
 
-	ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
+	ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
+	defer cancel()
 	pm.blockchain.(*light.LightChain).SyncCht(ctx)
-
 	pm.downloader.Synchronise(peer.id, peer.Head(), peer.Td(), downloader.LightSync)
 }
diff --git a/light/lightchain.go b/light/lightchain.go
index 4715d47ab815bde87279aa96c52ae989195b018f..82b7a5866bca32705f018867a3e04710bde0d80d 100644
--- a/light/lightchain.go
+++ b/light/lightchain.go
@@ -17,6 +17,7 @@
 package light
 
 import (
+	"context"
 	"math/big"
 	"sync"
 	"sync/atomic"
@@ -32,7 +33,6 @@ import (
 	"github.com/ethereum/go-ethereum/pow"
 	"github.com/ethereum/go-ethereum/rlp"
 	"github.com/hashicorp/golang-lru"
-	"golang.org/x/net/context"
 )
 
 var (
diff --git a/light/lightchain_test.go b/light/lightchain_test.go
index 8a99c69f13911f11af762960da8cbb7e333d0bc8..7460fd1a313ed022221692f6cb50bef40efceae6 100644
--- a/light/lightchain_test.go
+++ b/light/lightchain_test.go
@@ -17,6 +17,7 @@
 package light
 
 import (
+	"context"
 	"fmt"
 	"math/big"
 	"runtime"
@@ -30,7 +31,6 @@ import (
 	"github.com/ethereum/go-ethereum/params"
 	"github.com/ethereum/go-ethereum/pow"
 	"github.com/hashicorp/golang-lru"
-	"golang.org/x/net/context"
 )
 
 // So we can deterministically seed different blockchains
diff --git a/light/odr.go b/light/odr.go
index 4f6ef6b9ed94f8294a726316a6a49bcc3a87f5a9..ca6364f287f15fe6ac6b146e76ed007b9b5e1547 100644
--- a/light/odr.go
+++ b/light/odr.go
@@ -19,6 +19,7 @@
 package light
 
 import (
+	"context"
 	"math/big"
 
 	"github.com/ethereum/go-ethereum/common"
@@ -27,7 +28,6 @@ import (
 	"github.com/ethereum/go-ethereum/crypto"
 	"github.com/ethereum/go-ethereum/ethdb"
 	"github.com/ethereum/go-ethereum/rlp"
-	"golang.org/x/net/context"
 )
 
 // NoOdr is the default context passed to an ODR capable function when the ODR
diff --git a/light/odr_test.go b/light/odr_test.go
index e2eced34698b79eb6759ad330477738150a0b6df..ba82ec04fffdc7e8bc0efab09115b1ef3de11f09 100644
--- a/light/odr_test.go
+++ b/light/odr_test.go
@@ -18,6 +18,7 @@ package light
 
 import (
 	"bytes"
+	"context"
 	"errors"
 	"math/big"
 	"testing"
@@ -36,7 +37,6 @@ import (
 	"github.com/ethereum/go-ethereum/pow"
 	"github.com/ethereum/go-ethereum/rlp"
 	"github.com/ethereum/go-ethereum/trie"
-	"golang.org/x/net/context"
 )
 
 var (
@@ -277,8 +277,11 @@ func testChainOdr(t *testing.T, protocol int, expFail uint64, fn odrTestFn) {
 		for i := uint64(0); i <= blockchain.CurrentHeader().Number.Uint64(); i++ {
 			bhash := core.GetCanonicalHash(sdb, i)
 			b1 := fn(NoOdr, sdb, blockchain, nil, bhash)
-			ctx, _ := context.WithTimeout(context.Background(), 200*time.Millisecond)
+
+			ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond)
+			defer cancel()
 			b2 := fn(ctx, ldb, nil, lightchain, bhash)
+
 			eq := bytes.Equal(b1, b2)
 			exp := i < expFail
 			if exp && !eq {
diff --git a/light/odr_util.go b/light/odr_util.go
index 17e9aadcb29bcccf2de9b16742392863af44d03d..d7f8458f128d9bf0bf59e488e505a07be2bcdf84 100644
--- a/light/odr_util.go
+++ b/light/odr_util.go
@@ -18,6 +18,7 @@ package light
 
 import (
 	"bytes"
+	"context"
 	"errors"
 	"math/big"
 
@@ -27,7 +28,6 @@ import (
 	"github.com/ethereum/go-ethereum/crypto"
 	"github.com/ethereum/go-ethereum/ethdb"
 	"github.com/ethereum/go-ethereum/rlp"
-	"golang.org/x/net/context"
 )
 
 var sha3_nil = crypto.Keccak256Hash(nil)
diff --git a/light/state.go b/light/state.go
index d3e047ef475126ea8db7448a54928d579c2b32fc..b184dc3a5cdcb79ec535e1eecb4c22bc6e0c9fed 100644
--- a/light/state.go
+++ b/light/state.go
@@ -17,11 +17,11 @@
 package light
 
 import (
+	"context"
 	"math/big"
 
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/crypto"
-	"golang.org/x/net/context"
 )
 
 // LightState is a memory representation of a state.
diff --git a/light/state_object.go b/light/state_object.go
index f33ba217e9e7d087cac5c8d521f5bee142b90d8a..a54ea1d9ffe11d16cc38912e8dd54569a82da82d 100644
--- a/light/state_object.go
+++ b/light/state_object.go
@@ -18,13 +18,13 @@ package light
 
 import (
 	"bytes"
+	"context"
 	"fmt"
 	"math/big"
 
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/crypto"
 	"github.com/ethereum/go-ethereum/rlp"
-	"golang.org/x/net/context"
 )
 
 var emptyCodeHash = crypto.Keccak256(nil)
diff --git a/light/state_test.go b/light/state_test.go
index d594ab9ff0f934580fcbf1b973de2b6f2abe5347..e776efec8e8ccacccd0ecbb93046022f89dbdcc4 100644
--- a/light/state_test.go
+++ b/light/state_test.go
@@ -18,6 +18,7 @@ package light
 
 import (
 	"bytes"
+	"context"
 	"math/big"
 	"testing"
 
@@ -26,7 +27,6 @@ import (
 	"github.com/ethereum/go-ethereum/core/state"
 	"github.com/ethereum/go-ethereum/core/types"
 	"github.com/ethereum/go-ethereum/ethdb"
-	"golang.org/x/net/context"
 )
 
 func makeTestState() (common.Hash, ethdb.Database) {
diff --git a/light/trie.go b/light/trie.go
index c5525358a43be75b619785924db5ece1a114ed67..1440f2fbfdfc778314092c4f49d1fcbb47e05222 100644
--- a/light/trie.go
+++ b/light/trie.go
@@ -17,9 +17,10 @@
 package light
 
 import (
+	"context"
+
 	"github.com/ethereum/go-ethereum/ethdb"
 	"github.com/ethereum/go-ethereum/trie"
-	"golang.org/x/net/context"
 )
 
 // LightTrie is an ODR-capable wrapper around trie.SecureTrie
diff --git a/light/txpool.go b/light/txpool.go
index 5eb1ba8015c650f6ca678695ae95a50ac913a295..44619580650b6e023372891f0f8e7de1626cc3f0 100644
--- a/light/txpool.go
+++ b/light/txpool.go
@@ -17,6 +17,7 @@
 package light
 
 import (
+	"context"
 	"fmt"
 	"sync"
 	"time"
@@ -29,7 +30,6 @@ import (
 	"github.com/ethereum/go-ethereum/log"
 	"github.com/ethereum/go-ethereum/params"
 	"github.com/ethereum/go-ethereum/rlp"
-	"golang.org/x/net/context"
 )
 
 // txPermanent is the number of mined blocks after a mined transaction is
@@ -230,13 +230,13 @@ func (pool *TxPool) rollbackTxs(hash common.Hash, txc txStateChanges) {
 	}
 }
 
-// setNewHead sets a new head header, processing (and rolling back if necessary)
+// reorgOnNewHead sets a new head header, processing (and rolling back if necessary)
 // the blocks since the last known head and returns a txStateChanges map containing
 // the recently mined and rolled back transaction hashes. If an error (context
 // timeout) occurs during checking new blocks, it leaves the locally known head
 // at the latest checked block and still returns a valid txStateChanges, making it
 // possible to continue checking the missing blocks at the next chain head event
-func (pool *TxPool) setNewHead(ctx context.Context, newHeader *types.Header) (txStateChanges, error) {
+func (pool *TxPool) reorgOnNewHead(ctx context.Context, newHeader *types.Header) (txStateChanges, error) {
 	txc := make(txStateChanges)
 	oldh := pool.chain.GetHeaderByHash(pool.head)
 	newh := newHeader
@@ -305,20 +305,28 @@ func (pool *TxPool) eventLoop() {
 	for ev := range pool.events.Chan() {
 		switch ev.Data.(type) {
 		case core.ChainHeadEvent:
-			head := pool.chain.CurrentHeader()
-			pool.mu.Lock()
-			ctx, _ := context.WithTimeout(context.Background(), blockCheckTimeout)
-			txc, _ := pool.setNewHead(ctx, head)
-			m, r := txc.getLists()
-			pool.relay.NewHead(pool.head, m, r)
-			pool.homestead = pool.config.IsHomestead(head.Number)
-			pool.signer = types.MakeSigner(pool.config, head.Number)
-			pool.mu.Unlock()
-			time.Sleep(time.Millisecond) // hack in order to avoid hogging the lock; this part will be replaced by a subsequent PR
+			pool.setNewHead(ev.Data.(core.ChainHeadEvent).Block.Header())
+			// hack in order to avoid hogging the lock; this part will
+			// be replaced by a subsequent PR.
+			time.Sleep(time.Millisecond)
 		}
 	}
 }
 
+func (pool *TxPool) setNewHead(head *types.Header) {
+	pool.mu.Lock()
+	defer pool.mu.Unlock()
+
+	ctx, cancel := context.WithTimeout(context.Background(), blockCheckTimeout)
+	defer cancel()
+
+	txc, _ := pool.reorgOnNewHead(ctx, head)
+	m, r := txc.getLists()
+	pool.relay.NewHead(pool.head, m, r)
+	pool.homestead = pool.config.IsHomestead(head.Number)
+	pool.signer = types.MakeSigner(pool.config, head.Number)
+}
+
 // Stop stops the light transaction pool
 func (pool *TxPool) Stop() {
 	close(pool.quit)
diff --git a/light/txpool_test.go b/light/txpool_test.go
index 980c7c8987469a6c62f8dc9994b4b6b2d3497d67..e93955511b6249c935d7e73e14635b85d6c451fc 100644
--- a/light/txpool_test.go
+++ b/light/txpool_test.go
@@ -17,6 +17,7 @@
 package light
 
 import (
+	"context"
 	"math"
 	"math/big"
 	"testing"
@@ -30,7 +31,6 @@ import (
 	"github.com/ethereum/go-ethereum/event"
 	"github.com/ethereum/go-ethereum/params"
 	"github.com/ethereum/go-ethereum/pow"
-	"golang.org/x/net/context"
 )
 
 type testTxRelay struct {
@@ -107,10 +107,11 @@ func TestTxPool(t *testing.T) {
 	lightchain.SetValidator(bproc{})
 	txPermanent = 50
 	pool := NewTxPool(testChainConfig(), evmux, lightchain, relay)
+	ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
+	defer cancel()
 
 	for ii, block := range gchain {
 		i := ii + 1
-		ctx, _ := context.WithTimeout(context.Background(), 200*time.Millisecond)
 		s := sentTx(i - 1)
 		e := sentTx(i)
 		for i := s; i < e; i++ {
diff --git a/light/vm_env.go b/light/vm_env.go
index ebd229de8663b168e46342fccfae01fc8fa5351b..54aa12875b2326617c881c3b5e4528b7f688e88f 100644
--- a/light/vm_env.go
+++ b/light/vm_env.go
@@ -17,12 +17,12 @@
 package light
 
 import (
+	"context"
 	"math/big"
 
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/core/types"
 	"github.com/ethereum/go-ethereum/crypto"
-	"golang.org/x/net/context"
 )
 
 // VMState is a wrapper for the light state that holds the actual context and
diff --git a/mobile/big.go b/mobile/big.go
index 9a55836c13c6203c6466d0bf3a6467d3e6595633..525717caa8f8402909991ee531a8a4143c7b33e7 100644
--- a/mobile/big.go
+++ b/mobile/big.go
@@ -93,3 +93,8 @@ func (bi *BigInts) Set(index int, bigint *BigInt) error {
 	bi.bigints[index] = bigint.bigint
 	return nil
 }
+
+// GetString returns the value of x as a formatted string in some number base.
+func (bi *BigInt) GetString(base int) string {
+	return bi.bigint.Text(base)
+}
diff --git a/mobile/big_go1.7.go b/mobile/big_go1.7.go
deleted file mode 100644
index 0447e1f66e01a05673d4ca4bb8343e416a16437c..0000000000000000000000000000000000000000
--- a/mobile/big_go1.7.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2016 The go-ethereum Authors
-// This file is part of the go-ethereum library.
-//
-// The go-ethereum library is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The go-ethereum library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
-
-// Contains the wrappers from the math/big package that require Go 1.7 and above.
-
-// +build go1.7
-
-package geth
-
-// GetString returns the value of x as a formatted string in some number base.
-func (bi *BigInt) GetString(base int) string {
-	return bi.bigint.Text(base)
-}
diff --git a/mobile/context.go b/mobile/context.go
index 9df94b68963b2d575ba02e9141f796a418aba6ac..f1fff90114714f867aaa48baf39d69ad3f5fb95b 100644
--- a/mobile/context.go
+++ b/mobile/context.go
@@ -20,9 +20,8 @@
 package geth
 
 import (
+	"context"
 	"time"
-
-	"golang.org/x/net/context"
 )
 
 // Context carries a deadline, a cancelation signal, and other values across API
diff --git a/rpc/client.go b/rpc/client.go
index 78a6fe7899a4f6871185335c81f6487655c79f86..2c35ba54a5b74523e7ff0b7f30de1c7d43532510 100644
--- a/rpc/client.go
+++ b/rpc/client.go
@@ -19,6 +19,7 @@ package rpc
 import (
 	"bytes"
 	"container/list"
+	"context"
 	"encoding/json"
 	"errors"
 	"fmt"
@@ -31,7 +32,6 @@ import (
 	"time"
 
 	"github.com/ethereum/go-ethereum/log"
-	"golang.org/x/net/context"
 )
 
 var (
diff --git a/rpc/client_context_go1.4.go b/rpc/client_context_go1.4.go
deleted file mode 100644
index ac956a17dd37ed94dc467d4dd37618de20ab5dd1..0000000000000000000000000000000000000000
--- a/rpc/client_context_go1.4.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2016 The go-ethereum Authors
-// This file is part of the go-ethereum library.
-//
-// The go-ethereum library is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The go-ethereum library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
-
-// +build !go1.5
-
-package rpc
-
-import (
-	"net"
-	"net/http"
-	"time"
-
-	"golang.org/x/net/context"
-)
-
-// In older versions of Go (below 1.5), dials cannot be canceled
-// via a channel or context. The context deadline can still applied.
-
-// contextDialer returns a dialer that applies the deadline value from the given context.
-func contextDialer(ctx context.Context) *net.Dialer {
-	dialer := &net.Dialer{KeepAlive: tcpKeepAliveInterval}
-	if deadline, ok := ctx.Deadline(); ok {
-		dialer.Deadline = deadline
-	} else {
-		dialer.Deadline = time.Now().Add(defaultDialTimeout)
-	}
-	return dialer
-}
-
-// dialContext connects to the given address, aborting the dial if ctx is canceled.
-func dialContext(ctx context.Context, network, addr string) (net.Conn, error) {
-	return contextDialer(ctx).Dial(network, addr)
-}
-
-// requestWithContext copies req, adding the cancelation channel and deadline from ctx.
-func requestWithContext(c *http.Client, req *http.Request, ctx context.Context) (*http.Client, *http.Request) {
-	// Set Timeout on the client if the context has a deadline.
-	// Note that there is no default timeout (unlike in contextDialer) because
-	// the timeout applies to the entire request, including reads from body.
-	if deadline, ok := ctx.Deadline(); ok {
-		c2 := *c
-		c2.Timeout = deadline.Sub(time.Now())
-		c = &c2
-	}
-	req2 := *req
-	return c, &req2
-}
diff --git a/rpc/client_context_go1.5.go b/rpc/client_context_go1.5.go
deleted file mode 100644
index 4a007d9f8a6fcd8c67bef006c6515379e5c07807..0000000000000000000000000000000000000000
--- a/rpc/client_context_go1.5.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2016 The go-ethereum Authors
-// This file is part of the go-ethereum library.
-//
-// The go-ethereum library is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The go-ethereum library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
-
-// +build go1.5,!go1.6
-
-package rpc
-
-import (
-	"net"
-	"net/http"
-	"time"
-
-	"golang.org/x/net/context"
-)
-
-// In Go 1.5, dials cannot be canceled via a channel or context. The context deadline can
-// still be applied. Go 1.5 adds the ability to cancel HTTP requests via a channel.
-
-// contextDialer returns a dialer that applies the deadline value from the given context.
-func contextDialer(ctx context.Context) *net.Dialer {
-	dialer := &net.Dialer{KeepAlive: tcpKeepAliveInterval}
-	if deadline, ok := ctx.Deadline(); ok {
-		dialer.Deadline = deadline
-	} else {
-		dialer.Deadline = time.Now().Add(defaultDialTimeout)
-	}
-	return dialer
-}
-
-// dialContext connects to the given address, aborting the dial if ctx is canceled.
-func dialContext(ctx context.Context, network, addr string) (net.Conn, error) {
-	return contextDialer(ctx).Dial(network, addr)
-}
-
-// requestWithContext copies req, adding the cancelation channel and deadline from ctx.
-func requestWithContext(c *http.Client, req *http.Request, ctx context.Context) (*http.Client, *http.Request) {
-	// Set Timeout on the client if the context has a deadline.
-	// Note that there is no default timeout (unlike in contextDialer) because
-	// the timeout applies to the entire request, including reads from body.
-	if deadline, ok := ctx.Deadline(); ok {
-		c2 := *c
-		c2.Timeout = deadline.Sub(time.Now())
-		c = &c2
-	}
-	req2 := *req
-	req2.Cancel = ctx.Done()
-	return c, &req2
-}
diff --git a/rpc/client_context_go1.6.go b/rpc/client_context_go1.6.go
deleted file mode 100644
index 67777ddc6aacd08a1f6a1156118c4f20622ff2e5..0000000000000000000000000000000000000000
--- a/rpc/client_context_go1.6.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2016 The go-ethereum Authors
-// This file is part of the go-ethereum library.
-//
-// The go-ethereum library is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The go-ethereum library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
-
-// +build go1.6,!go1.7
-
-package rpc
-
-import (
-	"net"
-	"net/http"
-	"time"
-
-	"golang.org/x/net/context"
-)
-
-// In Go 1.6, net.Dialer gained the ability to cancel via a channel.
-
-// contextDialer returns a dialer that applies the deadline value from the given context.
-func contextDialer(ctx context.Context) *net.Dialer {
-	dialer := &net.Dialer{Cancel: ctx.Done(), KeepAlive: tcpKeepAliveInterval}
-	if deadline, ok := ctx.Deadline(); ok {
-		dialer.Deadline = deadline
-	} else {
-		dialer.Deadline = time.Now().Add(defaultDialTimeout)
-	}
-	return dialer
-}
-
-// dialContext connects to the given address, aborting the dial if ctx is canceled.
-func dialContext(ctx context.Context, network, addr string) (net.Conn, error) {
-	return contextDialer(ctx).Dial(network, addr)
-}
-
-// requestWithContext copies req, adding the cancelation channel and deadline from ctx.
-func requestWithContext(c *http.Client, req *http.Request, ctx context.Context) (*http.Client, *http.Request) {
-	// We set Timeout on the client for Go <= 1.5. There
-	// is no need to do that here because the dial will be canceled
-	// by package http.
-	req2 := *req
-	req2.Cancel = ctx.Done()
-	return c, &req2
-}
diff --git a/rpc/client_context_go1.7.go b/rpc/client_context_go1.7.go
deleted file mode 100644
index 56ce12ab8eaddf1c2f7197ef107c0894470772c4..0000000000000000000000000000000000000000
--- a/rpc/client_context_go1.7.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2016 The go-ethereum Authors
-// This file is part of the go-ethereum library.
-//
-// The go-ethereum library is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The go-ethereum library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
-
-// +build go1.7
-
-package rpc
-
-import (
-	"context"
-	"net"
-	"net/http"
-	"time"
-)
-
-// In Go 1.7, context moved into the standard library and support
-// for cancelation via context was added to net.Dialer and http.Request.
-
-// contextDialer returns a dialer that applies the deadline value from the given context.
-func contextDialer(ctx context.Context) *net.Dialer {
-	dialer := &net.Dialer{Cancel: ctx.Done(), KeepAlive: tcpKeepAliveInterval}
-	if deadline, ok := ctx.Deadline(); ok {
-		dialer.Deadline = deadline
-	} else {
-		dialer.Deadline = time.Now().Add(defaultDialTimeout)
-	}
-	return dialer
-}
-
-// dialContext connects to the given address, aborting the dial if ctx is canceled.
-func dialContext(ctx context.Context, network, addr string) (net.Conn, error) {
-	d := &net.Dialer{KeepAlive: tcpKeepAliveInterval}
-	return d.DialContext(ctx, network, addr)
-}
-
-// requestWithContext copies req, adding the cancelation channel and deadline from ctx.
-func requestWithContext(c *http.Client, req *http.Request, ctx context.Context) (*http.Client, *http.Request) {
-	return c, req.WithContext(ctx)
-}
diff --git a/rpc/client_example_test.go b/rpc/client_example_test.go
index 3462b3685bc225f4f13ddedac649e172f7894b3d..8276a9eadd13a25e4b3a576bd81b4b5087c8b450 100644
--- a/rpc/client_example_test.go
+++ b/rpc/client_example_test.go
@@ -17,12 +17,12 @@
 package rpc_test
 
 import (
+	"context"
 	"fmt"
 	"math/big"
 	"time"
 
 	"github.com/ethereum/go-ethereum/rpc"
-	"golang.org/x/net/context"
 )
 
 // In this example, our client whishes to track the latest 'block number'
diff --git a/rpc/client_test.go b/rpc/client_test.go
index 407ed9c0652d42c121549888ad34df1ee1b4e41a..41471dceaf72d65c8d0dff8ec01e884b3ef86767 100644
--- a/rpc/client_test.go
+++ b/rpc/client_test.go
@@ -17,6 +17,7 @@
 package rpc
 
 import (
+	"context"
 	"fmt"
 	"math/rand"
 	"net"
@@ -31,7 +32,6 @@ import (
 
 	"github.com/davecgh/go-spew/spew"
 	"github.com/ethereum/go-ethereum/log"
-	"golang.org/x/net/context"
 )
 
 func TestClientRequest(t *testing.T) {
diff --git a/rpc/http.go b/rpc/http.go
index 5a077023164fcb3d499b4a0458a4872ce8e2db89..89175b1496f7a348ad44e92ba717809323512aeb 100644
--- a/rpc/http.go
+++ b/rpc/http.go
@@ -18,6 +18,7 @@ package rpc
 
 import (
 	"bytes"
+	"context"
 	"encoding/json"
 	"fmt"
 	"io"
@@ -29,7 +30,6 @@ import (
 	"time"
 
 	"github.com/rs/cors"
-	"golang.org/x/net/context"
 )
 
 const (
@@ -115,11 +115,11 @@ func (hc *httpConn) doRequest(ctx context.Context, msg interface{}) (io.ReadClos
 	if err != nil {
 		return nil, err
 	}
-	client, req := requestWithContext(hc.client, hc.req, ctx)
+	req := hc.req.WithContext(ctx)
 	req.Body = ioutil.NopCloser(bytes.NewReader(body))
 	req.ContentLength = int64(len(body))
 
-	resp, err := client.Do(req)
+	resp, err := hc.client.Do(req)
 	if err != nil {
 		return nil, err
 	}
diff --git a/rpc/inproc.go b/rpc/inproc.go
index f72b974977c98d17b599ad17f8ed20501f871b64..595a7ca651fecfb5425d332e2253a24f0103d1f1 100644
--- a/rpc/inproc.go
+++ b/rpc/inproc.go
@@ -17,9 +17,8 @@
 package rpc
 
 import (
+	"context"
 	"net"
-
-	"golang.org/x/net/context"
 )
 
 // NewInProcClient attaches an in-process connection to the given RPC server.
diff --git a/rpc/ipc.go b/rpc/ipc.go
index 3c86d711ce9b654bda66deb696591c11756907cb..8de18a56fedad4acf9ec95bcb2ced0b078b89f99 100644
--- a/rpc/ipc.go
+++ b/rpc/ipc.go
@@ -17,12 +17,11 @@
 package rpc
 
 import (
+	"context"
 	"fmt"
 	"net"
 
 	"github.com/ethereum/go-ethereum/log"
-
-	"golang.org/x/net/context"
 )
 
 // CreateIPCListener creates an listener, on Unix platforms this is a unix socket, on
diff --git a/rpc/ipc_unix.go b/rpc/ipc_unix.go
index a25b21627736042e045515ef078cf36e1b912d62..0851ea61e16ac320d5991510713273e169323298 100644
--- a/rpc/ipc_unix.go
+++ b/rpc/ipc_unix.go
@@ -19,11 +19,10 @@
 package rpc
 
 import (
+	"context"
 	"net"
 	"os"
 	"path/filepath"
-
-	"golang.org/x/net/context"
 )
 
 // ipcListen will create a Unix socket on the given endpoint.
diff --git a/rpc/ipc_windows.go b/rpc/ipc_windows.go
index 68234d215115006ee3bb7373e4739591f520e5c3..ca56a3ce4313784df18cb1c58c9732756c3c4d16 100644
--- a/rpc/ipc_windows.go
+++ b/rpc/ipc_windows.go
@@ -19,10 +19,10 @@
 package rpc
 
 import (
+	"context"
 	"net"
 	"time"
 
-	"golang.org/x/net/context"
 	"gopkg.in/natefinch/npipe.v2"
 )
 
diff --git a/rpc/server.go b/rpc/server.go
index 4f9ce541e5c3c5ad1fc57fbe9bc96c3ffb8ae625..ca7e3c01a0822ba29f0f1c1fa24099d70b90532c 100644
--- a/rpc/server.go
+++ b/rpc/server.go
@@ -17,14 +17,13 @@
 package rpc
 
 import (
+	"context"
 	"fmt"
 	"reflect"
 	"runtime"
 	"sync/atomic"
 
 	"github.com/ethereum/go-ethereum/log"
-
-	"golang.org/x/net/context"
 	"gopkg.in/fatih/set.v0"
 )
 
diff --git a/rpc/server_test.go b/rpc/server_test.go
index c3c88fab755d4e93c9a7ef1b600fcd5212a1a7d5..90d62f26d8f61e74289e6e88e03315663d73489b 100644
--- a/rpc/server_test.go
+++ b/rpc/server_test.go
@@ -17,13 +17,12 @@
 package rpc
 
 import (
+	"context"
 	"encoding/json"
 	"net"
 	"reflect"
 	"testing"
 	"time"
-
-	"golang.org/x/net/context"
 )
 
 type Service struct{}
diff --git a/rpc/subscription.go b/rpc/subscription.go
index bcdc3cdfcadebc0c266b0a8cc6b51b614fd2e936..9ab6af9e14ee8a70dad6aec209a0ef5613933c5f 100644
--- a/rpc/subscription.go
+++ b/rpc/subscription.go
@@ -17,10 +17,9 @@
 package rpc
 
 import (
+	"context"
 	"errors"
 	"sync"
-
-	"golang.org/x/net/context"
 )
 
 var (
diff --git a/rpc/subscription_test.go b/rpc/subscription_test.go
index 00c4e0e3545dffc7fd15a796dfca270bd368d34d..345b4e5f29902f3427350c37973db36e3bd151cd 100644
--- a/rpc/subscription_test.go
+++ b/rpc/subscription_test.go
@@ -17,13 +17,12 @@
 package rpc
 
 import (
+	"context"
 	"encoding/json"
 	"net"
 	"sync"
 	"testing"
 	"time"
-
-	"golang.org/x/net/context"
 )
 
 type NotificationTestService struct {
diff --git a/rpc/utils.go b/rpc/utils.go
index c249e9b4a8871a8fa1fa5e2f36d163d666aad4e2..2506c483319ca0e286f151ce996e0732f792ae39 100644
--- a/rpc/utils.go
+++ b/rpc/utils.go
@@ -18,6 +18,7 @@ package rpc
 
 import (
 	"bufio"
+	"context"
 	crand "crypto/rand"
 	"encoding/binary"
 	"encoding/hex"
@@ -29,8 +30,6 @@ import (
 	"time"
 	"unicode"
 	"unicode/utf8"
-
-	"golang.org/x/net/context"
 )
 
 var (
diff --git a/rpc/websocket.go b/rpc/websocket.go
index f4271fda87b85ca1f60a5c18e8793cdde8615f73..5870108206cf3308bb4daf3513d7da4d273eb6c5 100644
--- a/rpc/websocket.go
+++ b/rpc/websocket.go
@@ -17,6 +17,7 @@
 package rpc
 
 import (
+	"context"
 	"crypto/tls"
 	"fmt"
 	"net"
@@ -24,10 +25,9 @@ import (
 	"net/url"
 	"os"
 	"strings"
+	"time"
 
 	"github.com/ethereum/go-ethereum/log"
-
-	"golang.org/x/net/context"
 	"golang.org/x/net/websocket"
 	"gopkg.in/fatih/set.v0"
 )
@@ -150,3 +150,18 @@ func wsDialAddress(location *url.URL) string {
 	}
 	return location.Host
 }
+
+func dialContext(ctx context.Context, network, addr string) (net.Conn, error) {
+	d := &net.Dialer{KeepAlive: tcpKeepAliveInterval}
+	return d.DialContext(ctx, network, addr)
+}
+
+func contextDialer(ctx context.Context) *net.Dialer {
+	dialer := &net.Dialer{Cancel: ctx.Done(), KeepAlive: tcpKeepAliveInterval}
+	if deadline, ok := ctx.Deadline(); ok {
+		dialer.Deadline = deadline
+	} else {
+		dialer.Deadline = time.Now().Add(defaultDialTimeout)
+	}
+	return dialer
+}
diff --git a/swarm/services/swap/swap.go b/swarm/services/swap/swap.go
index eb21a598d054debb4d4fe2b2b85f74ceaa0c69a0..093892e8d9e0c1bda7e9feb4a3d8393916dd8f95 100644
--- a/swarm/services/swap/swap.go
+++ b/swarm/services/swap/swap.go
@@ -17,6 +17,7 @@
 package swap
 
 import (
+	"context"
 	"crypto/ecdsa"
 	"fmt"
 	"math/big"
@@ -33,7 +34,6 @@ import (
 	"github.com/ethereum/go-ethereum/crypto"
 	"github.com/ethereum/go-ethereum/log"
 	"github.com/ethereum/go-ethereum/swarm/services/swap/swap"
-	"golang.org/x/net/context"
 )
 
 // SwAP       Swarm Accounting Protocol with
diff --git a/swarm/swarm.go b/swarm/swarm.go
index 44564a71d49c85ecbc2c0f9f92c3191c74f0f491..bd256edaa207433eb6025511838fa022d5427944 100644
--- a/swarm/swarm.go
+++ b/swarm/swarm.go
@@ -18,6 +18,7 @@ package swarm
 
 import (
 	"bytes"
+	"context"
 	"crypto/ecdsa"
 	"fmt"
 
@@ -35,7 +36,6 @@ import (
 	httpapi "github.com/ethereum/go-ethereum/swarm/api/http"
 	"github.com/ethereum/go-ethereum/swarm/network"
 	"github.com/ethereum/go-ethereum/swarm/storage"
-	"golang.org/x/net/context"
 )
 
 // the swarm stack
diff --git a/trie/trie_test.go b/trie/trie_test.go
index 60307dba8c361d69ee2426d9bd5adc82df080523..01ae3a4e7b09b735529a9ff472bea555e188a677 100644
--- a/trie/trie_test.go
+++ b/trie/trie_test.go
@@ -377,7 +377,7 @@ func (randTest) Generate(r *rand.Rand, size int) reflect.Value {
 		if len(allKeys) < 2 || r.Intn(100) < 10 {
 			// new key
 			key := make([]byte, r.Intn(50))
-			randRead(r, key)
+			r.Read(key)
 			allKeys = append(allKeys, key)
 			return key
 		}
@@ -401,22 +401,6 @@ func (randTest) Generate(r *rand.Rand, size int) reflect.Value {
 	return reflect.ValueOf(steps)
 }
 
-// rand.Rand provides a Read method in Go 1.7 and later, but
-// we can't use it yet.
-func randRead(r *rand.Rand, b []byte) {
-	pos := 0
-	val := 0
-	for n := 0; n < len(b); n++ {
-		if pos == 0 {
-			val = r.Int()
-			pos = 7
-		}
-		b[n] = byte(val)
-		val >>= 8
-		pos--
-	}
-}
-
 func runRandTest(rt randTest) bool {
 	db, _ := ethdb.NewMemDatabase()
 	tr, _ := New(common.Hash{}, db)
diff --git a/build/_vendor/src/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go
similarity index 82%
rename from build/_vendor/src/golang.org/x/net/context/context.go
rename to vendor/golang.org/x/net/context/context.go
index 134654cf7e2bf2ba2aaf2206e2e6f04460f412c7..f143ed6a1eb064088a860b89b1939acef1dc3b12 100644
--- a/build/_vendor/src/golang.org/x/net/context/context.go
+++ b/vendor/golang.org/x/net/context/context.go
@@ -7,7 +7,7 @@
 // and between processes.
 //
 // Incoming requests to a server should create a Context, and outgoing calls to
-// servers should accept a Context.  The chain of function calls between must
+// servers should accept a Context. The chain of function calls between must
 // propagate the Context, optionally replacing it with a modified copy created
 // using WithDeadline, WithTimeout, WithCancel, or WithValue.
 //
@@ -16,14 +16,14 @@
 // propagation:
 //
 // Do not store Contexts inside a struct type; instead, pass a Context
-// explicitly to each function that needs it.  The Context should be the first
+// explicitly to each function that needs it. The Context should be the first
 // parameter, typically named ctx:
 //
 // 	func DoSomething(ctx context.Context, arg Arg) error {
 // 		// ... use ctx ...
 // 	}
 //
-// Do not pass a nil Context, even if a function permits it.  Pass context.TODO
+// Do not pass a nil Context, even if a function permits it. Pass context.TODO
 // if you are unsure about which Context to use.
 //
 // Use context Values only for request-scoped data that transits processes and
@@ -44,13 +44,13 @@ import "time"
 // Context's methods may be called by multiple goroutines simultaneously.
 type Context interface {
 	// Deadline returns the time when work done on behalf of this context
-	// should be canceled.  Deadline returns ok==false when no deadline is
-	// set.  Successive calls to Deadline return the same results.
+	// should be canceled. Deadline returns ok==false when no deadline is
+	// set. Successive calls to Deadline return the same results.
 	Deadline() (deadline time.Time, ok bool)
 
 	// Done returns a channel that's closed when work done on behalf of this
-	// context should be canceled.  Done may return nil if this context can
-	// never be canceled.  Successive calls to Done return the same value.
+	// context should be canceled. Done may return nil if this context can
+	// never be canceled. Successive calls to Done return the same value.
 	//
 	// WithCancel arranges for Done to be closed when cancel is called;
 	// WithDeadline arranges for Done to be closed when the deadline
@@ -79,24 +79,24 @@ type Context interface {
 	// a Done channel for cancelation.
 	Done() <-chan struct{}
 
-	// Err returns a non-nil error value after Done is closed.  Err returns
+	// Err returns a non-nil error value after Done is closed. Err returns
 	// Canceled if the context was canceled or DeadlineExceeded if the
-	// context's deadline passed.  No other values for Err are defined.
+	// context's deadline passed. No other values for Err are defined.
 	// After Done is closed, successive calls to Err return the same value.
 	Err() error
 
 	// Value returns the value associated with this context for key, or nil
-	// if no value is associated with key.  Successive calls to Value with
+	// if no value is associated with key. Successive calls to Value with
 	// the same key returns the same result.
 	//
 	// Use context values only for request-scoped data that transits
 	// processes and API boundaries, not for passing optional parameters to
 	// functions.
 	//
-	// A key identifies a specific value in a Context.  Functions that wish
+	// A key identifies a specific value in a Context. Functions that wish
 	// to store values in Context typically allocate a key in a global
 	// variable then use that key as the argument to context.WithValue and
-	// Context.Value.  A key can be any type that supports equality;
+	// Context.Value. A key can be any type that supports equality;
 	// packages should define keys as an unexported type to avoid
 	// collisions.
 	//
@@ -115,7 +115,7 @@ type Context interface {
 	// 	// This prevents collisions with keys defined in other packages.
 	// 	type key int
 	//
-	// 	// userKey is the key for user.User values in Contexts.  It is
+	// 	// userKey is the key for user.User values in Contexts. It is
 	// 	// unexported; clients use user.NewContext and user.FromContext
 	// 	// instead of using this key directly.
 	// 	var userKey key = 0
@@ -134,14 +134,14 @@ type Context interface {
 }
 
 // Background returns a non-nil, empty Context. It is never canceled, has no
-// values, and has no deadline.  It is typically used by the main function,
+// values, and has no deadline. It is typically used by the main function,
 // initialization, and tests, and as the top-level Context for incoming
 // requests.
 func Background() Context {
 	return background
 }
 
-// TODO returns a non-nil, empty Context.  Code should use context.TODO when
+// TODO returns a non-nil, empty Context. Code should use context.TODO when
 // it's unclear which Context to use or it is not yet available (because the
 // surrounding function has not yet been extended to accept a Context
 // parameter).  TODO is recognized by static analysis tools that determine
diff --git a/build/_vendor/src/golang.org/x/net/context/go17.go b/vendor/golang.org/x/net/context/go17.go
similarity index 96%
rename from build/_vendor/src/golang.org/x/net/context/go17.go
rename to vendor/golang.org/x/net/context/go17.go
index f8cda19adaee90ab3c324e0092cdf360fa8c65f1..d20f52b7de93f81675cb405bd4309af9ee61d2d1 100644
--- a/build/_vendor/src/golang.org/x/net/context/go17.go
+++ b/vendor/golang.org/x/net/context/go17.go
@@ -35,8 +35,8 @@ func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
 }
 
 // WithDeadline returns a copy of the parent context with the deadline adjusted
-// to be no later than d.  If the parent's deadline is already earlier than d,
-// WithDeadline(parent, d) is semantically equivalent to parent.  The returned
+// to be no later than d. If the parent's deadline is already earlier than d,
+// WithDeadline(parent, d) is semantically equivalent to parent. The returned
 // context's Done channel is closed when the deadline expires, when the returned
 // cancel function is called, or when the parent context's Done channel is
 // closed, whichever happens first.
diff --git a/build/_vendor/src/golang.org/x/net/context/pre_go17.go b/vendor/golang.org/x/net/context/pre_go17.go
similarity index 93%
rename from build/_vendor/src/golang.org/x/net/context/pre_go17.go
rename to vendor/golang.org/x/net/context/pre_go17.go
index 5a30acabd03c329e79666269531751840fe86e7a..0f35592df51885abc1eb01b2e58318590df65874 100644
--- a/build/_vendor/src/golang.org/x/net/context/pre_go17.go
+++ b/vendor/golang.org/x/net/context/pre_go17.go
@@ -13,7 +13,7 @@ import (
 	"time"
 )
 
-// An emptyCtx is never canceled, has no values, and has no deadline.  It is not
+// An emptyCtx is never canceled, has no values, and has no deadline. It is not
 // struct{}, since vars of this type must have distinct addresses.
 type emptyCtx int
 
@@ -104,7 +104,7 @@ func propagateCancel(parent Context, child canceler) {
 }
 
 // parentCancelCtx follows a chain of parent references until it finds a
-// *cancelCtx.  This function understands how each of the concrete types in this
+// *cancelCtx. This function understands how each of the concrete types in this
 // package represents its parent.
 func parentCancelCtx(parent Context) (*cancelCtx, bool) {
 	for {
@@ -134,14 +134,14 @@ func removeChild(parent Context, child canceler) {
 	p.mu.Unlock()
 }
 
-// A canceler is a context type that can be canceled directly.  The
+// A canceler is a context type that can be canceled directly. The
 // implementations are *cancelCtx and *timerCtx.
 type canceler interface {
 	cancel(removeFromParent bool, err error)
 	Done() <-chan struct{}
 }
 
-// A cancelCtx can be canceled.  When canceled, it also cancels any children
+// A cancelCtx can be canceled. When canceled, it also cancels any children
 // that implement canceler.
 type cancelCtx struct {
 	Context
@@ -193,8 +193,8 @@ func (c *cancelCtx) cancel(removeFromParent bool, err error) {
 }
 
 // WithDeadline returns a copy of the parent context with the deadline adjusted
-// to be no later than d.  If the parent's deadline is already earlier than d,
-// WithDeadline(parent, d) is semantically equivalent to parent.  The returned
+// to be no later than d. If the parent's deadline is already earlier than d,
+// WithDeadline(parent, d) is semantically equivalent to parent. The returned
 // context's Done channel is closed when the deadline expires, when the returned
 // cancel function is called, or when the parent context's Done channel is
 // closed, whichever happens first.
@@ -226,8 +226,8 @@ func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
 	return c, func() { c.cancel(true, Canceled) }
 }
 
-// A timerCtx carries a timer and a deadline.  It embeds a cancelCtx to
-// implement Done and Err.  It implements cancel by stopping its timer then
+// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to
+// implement Done and Err. It implements cancel by stopping its timer then
 // delegating to cancelCtx.cancel.
 type timerCtx struct {
 	*cancelCtx
@@ -281,7 +281,7 @@ func WithValue(parent Context, key interface{}, val interface{}) Context {
 	return &valueCtx{parent, key, val}
 }
 
-// A valueCtx carries a key-value pair.  It implements Value for that key and
+// A valueCtx carries a key-value pair. It implements Value for that key and
 // delegates all other calls to the embedded Context.
 type valueCtx struct {
 	Context
diff --git a/vendor/vendor.json b/vendor/vendor.json
index 58bbd82ff8b749fb004dd7cabcd066058639eadc..eaaf0290d14b2cb3900c557781808c235932745b 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -1,6 +1,6 @@
 {
 	"comment": "",
-	"ignore": "test golang.org/x/net/context",
+	"ignore": "test",
 	"package": [
 		{
 			"checksumSHA1": "M30X+Wqn7AnUr1numUOkQRI7ET0=",
@@ -383,6 +383,12 @@
 			"revision": "453249f01cfeb54c3d549ddb75ff152ca243f9d8",
 			"revisionTime": "2017-02-08T20:51:15Z"
 		},
+		{
+			"checksumSHA1": "Y+HGqEkYM15ir+J93MEaHdyFy0c=",
+			"path": "golang.org/x/net/context",
+			"revision": "a6577fac2d73be281a500b310739095313165611",
+			"revisionTime": "2017-03-08T20:54:49Z"
+		},
 		{
 			"checksumSHA1": "vqc3a+oTUGX8PmD0TS+qQ7gmN8I=",
 			"path": "golang.org/x/net/html",
diff --git a/whisper/whisperv5/filter_test.go b/whisper/whisperv5/filter_test.go
index d69fb40dbfee43e084e39a501f0ad224864e81f8..1cf85b8d7ed461a7dfe1dff258c293f5eda5c2e2 100644
--- a/whisper/whisperv5/filter_test.go
+++ b/whisper/whisperv5/filter_test.go
@@ -18,7 +18,7 @@ package whisperv5
 
 import (
 	"math/big"
-	"math/rand"
+	mrand "math/rand"
 	"testing"
 	"time"
 
@@ -33,12 +33,12 @@ var seed int64
 // reproduciblity independent of their sequence.
 func InitSingleTest() {
 	seed = time.Now().Unix()
-	rand.Seed(seed)
+	mrand.Seed(seed)
 }
 
 func InitDebugTest(i int64) {
 	seed = i
-	rand.Seed(seed)
+	mrand.Seed(seed)
 }
 
 type FilterTestCase struct {
@@ -55,7 +55,7 @@ func generateFilter(t *testing.T, symmetric bool) (*Filter, error) {
 	const topicNum = 8
 	f.Topics = make([]TopicType, topicNum)
 	for i := 0; i < topicNum; i++ {
-		randomize(f.Topics[i][:])
+		mrand.Read(f.Topics[i][:])
 		f.Topics[i][0] = 0x01
 	}
 
@@ -68,7 +68,7 @@ func generateFilter(t *testing.T, symmetric bool) (*Filter, error) {
 
 	if symmetric {
 		f.KeySym = make([]byte, 12)
-		randomize(f.KeySym)
+		mrand.Read(f.KeySym)
 		f.SymKeyHash = crypto.Keccak256Hash(f.KeySym)
 	} else {
 		f.KeyAsym, err = crypto.GenerateKey()
@@ -87,7 +87,7 @@ func generateTestCases(t *testing.T, SizeTestFilters int) []FilterTestCase {
 	for i := 0; i < SizeTestFilters; i++ {
 		f, _ := generateFilter(t, true)
 		cases[i].f = f
-		cases[i].alive = (rand.Int()&int(1) == 0)
+		cases[i].alive = (mrand.Int()&int(1) == 0)
 	}
 	return cases
 }
@@ -147,7 +147,7 @@ func TestComparePubKey(t *testing.T) {
 	}
 
 	// generate key3 == key1
-	rand.Seed(seed)
+	mrand.Seed(seed)
 	key3, err := crypto.GenerateKey()
 	if err != nil {
 		t.Fatalf("failed to generate third key with seed %d: %s.", seed, err)
@@ -193,7 +193,7 @@ func TestMatchEnvelope(t *testing.T) {
 	}
 
 	// encrypt symmetrically
-	i := rand.Int() % 4
+	i := mrand.Int() % 4
 	fsym.Topics[i] = params.Topic
 	fasym.Topics[i] = params.Topic
 	msg = NewSentMessage(params)
@@ -544,7 +544,7 @@ func TestWatchers(t *testing.T) {
 
 	var envelopes [NumMessages]*Envelope
 	for i = 0; i < NumMessages; i++ {
-		j = rand.Uint32() % NumFilters
+		j = mrand.Uint32() % NumFilters
 		e = generateCompatibeEnvelope(t, tst[j].f)
 		envelopes[i] = e
 		tst[j].msgCnt++
@@ -597,7 +597,7 @@ func TestWatchers(t *testing.T) {
 	envelopes[0] = e
 	tst[0].msgCnt++
 	for i = 1; i < NumMessages; i++ {
-		j = rand.Uint32() % NumFilters
+		j = mrand.Uint32() % NumFilters
 		e = generateCompatibeEnvelope(t, tst[j].f)
 		envelopes[i] = e
 		tst[j].msgCnt++
diff --git a/whisper/whisperv5/message.go b/whisper/whisperv5/message.go
index 9677f278e5b89510bddaeda9c56e3c71f4329603..5f964b072ad06fe3969a1514e2a475bfd6a8b925 100644
--- a/whisper/whisperv5/message.go
+++ b/whisper/whisperv5/message.go
@@ -128,7 +128,7 @@ func (msg *SentMessage) appendPadding(params *MessageParams) {
 			panic("please fix the padding algorithm before releasing new version")
 		}
 		buf := make([]byte, padSize)
-		randomize(buf[1:])
+		mrand.Read(buf[1:])
 		buf[0] = byte(padSize)
 		if params.Padding != nil {
 			copy(buf[1:], params.Padding)
@@ -365,19 +365,3 @@ func (msg *ReceivedMessage) hash() []byte {
 	}
 	return crypto.Keccak256(msg.Raw)
 }
-
-// rand.Rand provides a Read method in Go 1.7 and later,
-// but we can't use it yet.
-func randomize(b []byte) {
-	cnt := 0
-	val := mrand.Int63()
-	for n := 0; n < len(b); n++ {
-		b[n] = byte(val)
-		val >>= 8
-		cnt++
-		if cnt >= 7 {
-			cnt = 0
-			val = mrand.Int63()
-		}
-	}
-}
diff --git a/whisper/whisperv5/message_test.go b/whisper/whisperv5/message_test.go
index c6f1ca2caf5bdc26dc241755093d356df7e8e849..1ed7250d3a00608ee96e026ca710841f88b02aaa 100644
--- a/whisper/whisperv5/message_test.go
+++ b/whisper/whisperv5/message_test.go
@@ -18,7 +18,7 @@ package whisperv5
 
 import (
 	"bytes"
-	"math/rand"
+	mrand "math/rand"
 	"testing"
 
 	"github.com/ethereum/go-ethereum/crypto"
@@ -34,13 +34,13 @@ func generateMessageParams() (*MessageParams, error) {
 	// set all the parameters except p.Dst
 
 	buf := make([]byte, 1024)
-	randomize(buf)
-	sz := rand.Intn(400)
+	mrand.Read(buf)
+	sz := mrand.Intn(400)
 
 	var p MessageParams
 	p.PoW = 0.01
 	p.WorkTime = 1
-	p.TTL = uint32(rand.Intn(1024))
+	p.TTL = uint32(mrand.Intn(1024))
 	p.Payload = make([]byte, sz)
 	p.Padding = make([]byte, padSizeLimitUpper)
 	p.KeySym = make([]byte, aesKeyLength)
@@ -132,7 +132,7 @@ func TestMessageEncryption(t *testing.T) {
 
 func TestMessageWrap(t *testing.T) {
 	seed = int64(1777444222)
-	rand.Seed(seed)
+	mrand.Seed(seed)
 	target := 128.0
 
 	params, err := generateMessageParams()
@@ -168,7 +168,7 @@ func TestMessageWrap(t *testing.T) {
 func TestMessageSeal(t *testing.T) {
 	// this test depends on deterministic choice of seed (1976726903)
 	seed = int64(1976726903)
-	rand.Seed(seed)
+	mrand.Seed(seed)
 
 	params, err := generateMessageParams()
 	if err != nil {
@@ -179,8 +179,8 @@ func TestMessageSeal(t *testing.T) {
 	params.TTL = 1
 	aesnonce := make([]byte, 12)
 	salt := make([]byte, 12)
-	randomize(aesnonce)
-	randomize(salt)
+	mrand.Read(aesnonce)
+	mrand.Read(salt)
 
 	env := NewEnvelope(params.TTL, params.Topic, salt, aesnonce, msg)
 	if err != nil {
diff --git a/whisper/whisperv5/whisper_test.go b/whisper/whisperv5/whisper_test.go
index 312dacfc4bfb65cb319f257c29f8e4840f6f2dfe..8d63d443cf1e9464f595f7958afa9e5636a3579d 100644
--- a/whisper/whisperv5/whisper_test.go
+++ b/whisper/whisperv5/whisper_test.go
@@ -18,6 +18,7 @@ package whisperv5
 
 import (
 	"bytes"
+	mrand "math/rand"
 	"testing"
 	"time"
 
@@ -49,7 +50,7 @@ func TestWhisperBasic(t *testing.T) {
 	}
 
 	peerID := make([]byte, 64)
-	randomize(peerID)
+	mrand.Read(peerID)
 	peer, _ := w.getPeer(peerID)
 	if peer != nil {
 		t.Fatal("found peer for random key.")
@@ -212,7 +213,7 @@ func TestWhisperSymKeyManagement(t *testing.T) {
 
 	// add existing id, nothing should change
 	randomKey := make([]byte, 16)
-	randomize(randomKey)
+	mrand.Read(randomKey)
 	err = w.AddSymKey(id1, randomKey)
 	if err == nil {
 		t.Fatalf("failed AddSymKey with seed %d.", seed)