Skip to content
  • Jeffrey Wilcke's avatar
    2e6b9c14
    [release/1.4.4] accounts/abi: fixed unpacking in to already slice interfaces · 2e6b9c14
    Jeffrey Wilcke authored
    Previously it was assumed that wheneven type `[]interface{}` was given
    that the interface was empty. The abigen rightfully assumed that
    interface slices which already have pre-allocated variable sets to be
    assigned.
    
    This PR fixes that by checking that the given `[]interface{}` is larger
    than zero and assigns each value using the generic `set` function (this
    function has also been moved to abi/reflect.go) and checks whether the
    assignment was possible.
    
    The generic assignment function `set` now also deals with pointers
    (useful for interface slice mentioned above) by dereferencing the
    pointer until it finds a setable type.
    
    (cherry picked from commit 91a7a4a7)
    2e6b9c14
    [release/1.4.4] accounts/abi: fixed unpacking in to already slice interfaces
    Jeffrey Wilcke authored
    Previously it was assumed that wheneven type `[]interface{}` was given
    that the interface was empty. The abigen rightfully assumed that
    interface slices which already have pre-allocated variable sets to be
    assigned.
    
    This PR fixes that by checking that the given `[]interface{}` is larger
    than zero and assigns each value using the generic `set` function (this
    function has also been moved to abi/reflect.go) and checks whether the
    assignment was possible.
    
    The generic assignment function `set` now also deals with pointers
    (useful for interface slice mentioned above) by dereferencing the
    pointer until it finds a setable type.
    
    (cherry picked from commit 91a7a4a7)
Loading