diff --git a/abi2/abi2.go b/abi2/abi2.go index 75485986..861fd7ca 100644 --- a/abi2/abi2.go +++ b/abi2/abi2.go @@ -537,7 +537,7 @@ func (e Event) Selected() []Input { func (e Event) numIndexed() int { var res int - for _, inp := range e.Selected() { + for _, inp := range e.Inputs { if inp.Indexed { res++ } diff --git a/abi2/abi2_test.go b/abi2/abi2_test.go index 9b46109e..6b316862 100644 --- a/abi2/abi2_test.go +++ b/abi2/abi2_test.go @@ -299,3 +299,15 @@ func TestSelected(t *testing.T) { } diff.Test(t, t.Errorf, want, event.Selected()) } + +func TestNumIndexed(t *testing.T) { + event := Event{ + Name: "", + Inputs: []Input{ + Input{Indexed: true, Name: "a"}, + Input{Indexed: true, Name: "b", Column: "b"}, + Input{Indexed: true, Name: "c", Column: "c"}, + }, + } + diff.Test(t, t.Errorf, 3, event.numIndexed()) +}