Skip to content

Filtering transfer logs returns empty data #24241

Closed
@beansgum

Description

@beansgum

System information

Geth version: geth version

Geth
Version: 1.10.15-stable
Git Commit: 8be800ffa9c4992666e2620e0ab4725a1a83352b
Architecture: amd64
Go Version: go1.17.5
Operating System: linux
GOPATH=/home/ubuntu/go
GOROOT=go

OS & Version: Linux

Expected behaviour

Expected vlog.Data to contain log data.

Actual behaviour

vlog.Data has a length of 0.

Steps to reproduce the behaviour

query := ethereum.FilterQuery{
	FromBlock: big.NewInt(startBlock),
	ToBlock:   big.NewInt(startBlock + blockIntervals),
	Topics:    [][]common.Hash{{transferEventTopicId}},
}

logs, err := client.FilterLogs(context.Background(), query)
if err != nil {
	return err
}
for _, vLog := range logs {

	if vLog.Removed {
		continue
	}

	event := tokencontract.TokencontractTransfer{}
	err := contractAbi.UnpackIntoInterface(&event, "Transfer", vLog.Data)
	if err != nil {
		log.Errorf("error unpacking into interface: %v", err)
		continue
	}
}

Backtrace

error unpacking into interface: abi: attempting to unmarshall an empty string while arguments are expected

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions