mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
rpc: simplify suitableCallbacks
This commit is contained in:
parent
1ff152f3a4
commit
1af79d14dd
1 changed files with 10 additions and 18 deletions
18
rpc/utils.go
18
rpc/utils.go
|
|
@ -133,10 +133,12 @@ METHODS:
|
|||
firstArg = 2
|
||||
}
|
||||
|
||||
if h.isSubscribe {
|
||||
h.argTypes = make([]reflect.Type, numIn-firstArg) // skip rcvr type
|
||||
// determine method arguments, ignore first arg since it's the receiver type
|
||||
h.argTypes = make([]reflect.Type, numIn-firstArg)
|
||||
for i := firstArg; i < numIn; i++ {
|
||||
argType := mtype.In(i)
|
||||
|
||||
// Arguments must be exported or builtin types
|
||||
if isExportedOrBuiltinType(argType) {
|
||||
h.argTypes[i-firstArg] = argType
|
||||
} else {
|
||||
|
|
@ -144,21 +146,11 @@ METHODS:
|
|||
}
|
||||
}
|
||||
|
||||
if h.isSubscribe {
|
||||
subscriptions[mname] = &h
|
||||
continue METHODS
|
||||
}
|
||||
|
||||
// determine method arguments, ignore first arg since it's the receiver type
|
||||
// Arguments must be exported or builtin types
|
||||
h.argTypes = make([]reflect.Type, numIn-firstArg)
|
||||
for i := firstArg; i < numIn; i++ {
|
||||
argType := mtype.In(i)
|
||||
if !isExportedOrBuiltinType(argType) {
|
||||
continue METHODS
|
||||
}
|
||||
h.argTypes[i-firstArg] = argType
|
||||
}
|
||||
|
||||
// check that all returned values are exported or builtin types
|
||||
for i := 0; i < mtype.NumOut(); i++ {
|
||||
if !isExportedOrBuiltinType(mtype.Out(i)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue