diff options
author | Felix Lange <fjl@twurst.com> | 2016-04-16 00:05:24 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-04-16 00:10:52 +0800 |
commit | a40e61b4ac44a4f64f057a4220a26cfe4b9dcf03 (patch) | |
tree | 401218a5f3ed5b4fac88baf87551bd3f57f3c34b /eth/api.go | |
parent | 6197fbf8d70c1aa96c3e87de91ff3f46f454c1ea (diff) | |
download | go-tangerine-a40e61b4ac44a4f64f057a4220a26cfe4b9dcf03.tar go-tangerine-a40e61b4ac44a4f64f057a4220a26cfe4b9dcf03.tar.gz go-tangerine-a40e61b4ac44a4f64f057a4220a26cfe4b9dcf03.tar.bz2 go-tangerine-a40e61b4ac44a4f64f057a4220a26cfe4b9dcf03.tar.lz go-tangerine-a40e61b4ac44a4f64f057a4220a26cfe4b9dcf03.tar.xz go-tangerine-a40e61b4ac44a4f64f057a4220a26cfe4b9dcf03.tar.zst go-tangerine-a40e61b4ac44a4f64f057a4220a26cfe4b9dcf03.zip |
rpc: remove NotifierContextKey
Context keys must have a unique type in order to prevent
any unintented clashes. The code used int(1) as key.
Fix it by implementing the pattern recommended by package context.
Diffstat (limited to 'eth/api.go')
-rw-r--r-- | eth/api.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/eth/api.go b/eth/api.go index 41387c27f..a0b1f8ac2 100644 --- a/eth/api.go +++ b/eth/api.go @@ -603,7 +603,7 @@ type NewBlocksArgs struct { // NewBlocks triggers a new block event each time a block is appended to the chain. It accepts an argument which allows // the caller to specify whether the output should contain transactions and in what format. func (s *PublicBlockChainAPI) NewBlocks(ctx context.Context, args NewBlocksArgs) (rpc.Subscription, error) { - notifier, supported := ctx.Value(rpc.NotifierContextKey).(rpc.Notifier) + notifier, supported := rpc.NotifierFromContext(ctx) if !supported { return nil, rpc.ErrNotificationsUnsupported } @@ -1345,7 +1345,7 @@ func (s *PublicTransactionPoolAPI) PendingTransactions() []*RPCTransaction { // NewPendingTransaction creates a subscription that is triggered each time a transaction enters the transaction pool // and is send from one of the transactions this nodes manages. func (s *PublicTransactionPoolAPI) NewPendingTransactions(ctx context.Context) (rpc.Subscription, error) { - notifier, supported := ctx.Value(rpc.NotifierContextKey).(rpc.Notifier) + notifier, supported := rpc.NotifierFromContext(ctx) if !supported { return nil, rpc.ErrNotificationsUnsupported } |