diff options
author | Egon Elbre <egonelbre@gmail.com> | 2017-08-08 17:08:37 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-08-08 17:08:37 +0800 |
commit | e063d538b80d2edfc3c2b374aaee4e38e2145170 (patch) | |
tree | fd27b3a044dc674b9c6d3415a1dfca465d846fa5 /rpc/utils.go | |
parent | 43437806fb49d4ca0b5f6e7599c9871663960b15 (diff) | |
download | dexon-e063d538b80d2edfc3c2b374aaee4e38e2145170.tar.gz dexon-e063d538b80d2edfc3c2b374aaee4e38e2145170.tar.zst dexon-e063d538b80d2edfc3c2b374aaee4e38e2145170.zip |
rpc: fix megacheck warnings
Diffstat (limited to 'rpc/utils.go')
-rw-r--r-- | rpc/utils.go | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/rpc/utils.go b/rpc/utils.go index 2506c4833..9315cab59 100644 --- a/rpc/utils.go +++ b/rpc/utils.go @@ -119,21 +119,6 @@ func isHexNum(t reflect.Type) bool { return t == bigIntType } -var blockNumberType = reflect.TypeOf((*BlockNumber)(nil)).Elem() - -// Indication if the given block is a BlockNumber -func isBlockNumber(t reflect.Type) bool { - if t == nil { - return false - } - - for t.Kind() == reflect.Ptr { - t = t.Elem() - } - - return t == blockNumberType -} - // suitableCallbacks iterates over the methods of the given type. It will determine if a method satisfies the criteria // for a RPC callback or a subscription callback and adds it to the collection of callbacks or subscriptions. See server // documentation for a summary of these criteria. @@ -210,18 +195,12 @@ METHODS: } switch mtype.NumOut() { - case 0, 1: - break - case 2: - if h.errPos == -1 { // method must one return value and 1 error + case 0, 1, 2: + if mtype.NumOut() == 2 && h.errPos == -1 { // method must one return value and 1 error continue METHODS } - break - default: - continue METHODS + callbacks[mname] = &h } - - callbacks[mname] = &h } return callbacks, subscriptions |