From d97a1c6f759193e1c09a834f33e8c7690713b7ca Mon Sep 17 00:00:00 2001 From: Domino Valdano Date: Sun, 15 Apr 2018 19:57:03 -0700 Subject: [PATCH] eth/filters: use map[common.Hash]struct{} instead of map[common.Hash]bool for txListen --- eth/filters/api.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eth/filters/api.go b/eth/filters/api.go index 742b649ef1..4a4041bf17 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -269,7 +269,7 @@ func (api *PublicFilterAPI) ReturnData(ctx context.Context) (*rpc.Subscription, return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported } - txListen := make(map[common.Hash]bool) + txListen := make(map[common.Hash]struct{}) rpcSub := notifier.CreateSubscription() rpcSub.SetType(rpc.ReturnDataSubscription) @@ -284,12 +284,12 @@ func (api *PublicFilterAPI) ReturnData(ctx context.Context) (*rpc.Subscription, // client submitted new tx, save hash for later hash, ishash := msg.(common.Hash) if ishash { - txListen[hash] = true + txListen[hash] = struct{}{} } else { log.Warn(fmt.Sprintf("Received update msg of invalid type %s for ReturnData subscription", reflect.TypeOf(msg).String())) } case retdata := <-retCh: - if txListen[retdata.TxHash] { + if _, has := txListen[retdata.TxHash]; has { // tx from client just completed execution--send back return data notifier.Notify(rpcSub.ID, retdata) }