rpc: support returning nil pointer big.Ints (null)

This commit is contained in:
Péter Szilágyi
2018-06-11 13:15:59 +03:00
parent 1d666cf27e
commit 99483e85b9
4 changed files with 7 additions and 31 deletions

View File

@ -22,7 +22,6 @@ import (
crand "crypto/rand"
"encoding/binary"
"encoding/hex"
"math/big"
"math/rand"
"reflect"
"strings"
@ -105,20 +104,6 @@ func formatName(name string) string {
return string(ret)
}
var bigIntType = reflect.TypeOf((*big.Int)(nil)).Elem()
// Indication if this type should be serialized in hex
func isHexNum(t reflect.Type) bool {
if t == nil {
return false
}
for t.Kind() == reflect.Ptr {
t = t.Elem()
}
return t == bigIntType
}
// 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.