rpc: fix megacheck warnings

This commit is contained in:
Egon Elbre
2017-08-08 12:08:37 +03:00
committed by Felix Lange
parent 43437806fb
commit e063d538b8
5 changed files with 24 additions and 62 deletions

View File

@ -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