accounts/abi/bind: restore error functionality (#21743)

This commit is contained in:
Daniel Liu 2025-01-14 10:56:11 +08:00
parent 3946405983
commit c7efbcd9fd

View file

@ -160,7 +160,10 @@ func (c *BoundContract) Call(opts *CallOpts, results *[]interface{}, method stri
}
} else {
output, err = c.caller.CallContract(ctx, msg, opts.BlockNumber)
if err == nil && len(output) == 0 {
if err != nil {
return err
}
if len(output) == 0 {
// Make sure we have a contract to operate on, and bail out otherwise.
if code, err = c.caller.CodeAt(ctx, c.address, opts.BlockNumber); err != nil {
return err