mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
Revert "ethereum, mobile: nullable topics for filter criteria"
This reverts commit 0773893f4b.
This commit is contained in:
parent
0773893f4b
commit
b4b1f6f002
3 changed files with 7 additions and 62 deletions
|
|
@ -146,7 +146,7 @@ type FilterQuery struct {
|
||||||
// {{}, {B}} matches any topic in first position, B in second position
|
// {{}, {B}} matches any topic in first position, B in second position
|
||||||
// {{A}}, {B}} matches topic A in first position, B in second position
|
// {{A}}, {B}} matches topic A in first position, B in second position
|
||||||
// {{A, B}}, {C, D}} matches topic (A OR B) in first position, (C OR D) in second position
|
// {{A, B}}, {C, D}} matches topic (A OR B) in first position, (C OR D) in second position
|
||||||
Topics [][]*common.Hash
|
Topics [][]common.Hash
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogFilterer provides access to contract log events using a one-off query or continuous
|
// LogFilterer provides access to contract log events using a one-off query or continuous
|
||||||
|
|
|
||||||
|
|
@ -128,61 +128,6 @@ func (h *Hashes) Append(hash *Hash) {
|
||||||
h.hashes = append(h.hashes, hash.hash)
|
h.hashes = append(h.hashes, hash.hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NullableHashes represents a slice of hashes that can have the null value too.
|
|
||||||
type NullableHashes struct{ hashes []*common.Hash }
|
|
||||||
|
|
||||||
// NewNullableHashes creates a slice of uninitialized NullableHashes.
|
|
||||||
func NewNullableHashes(size int) *NullableHashes {
|
|
||||||
return &NullableHashes{
|
|
||||||
hashes: make([]*common.Hash, size),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewNullableHashesEmpty creates an empty slice of NullableHashes values.
|
|
||||||
func NewNullableHashesEmpty() *NullableHashes {
|
|
||||||
return NewNullableHashes(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Size returns the number of hashes in the slice.
|
|
||||||
func (h *NullableHashes) Size() int {
|
|
||||||
return len(h.hashes)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get returns the hash at the given index from the slice.
|
|
||||||
func (h *NullableHashes) Get(index int) (hash *Hash, _ error) {
|
|
||||||
if index < 0 || index >= len(h.hashes) {
|
|
||||||
return nil, errors.New("index out of bounds")
|
|
||||||
}
|
|
||||||
if h.hashes[index] == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return &Hash{*h.hashes[index]}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set sets the Hash at the given index in the slice.
|
|
||||||
func (h *NullableHashes) Set(index int, hash *Hash) error {
|
|
||||||
if index < 0 || index >= len(h.hashes) {
|
|
||||||
return errors.New("index out of bounds")
|
|
||||||
}
|
|
||||||
if hash == nil {
|
|
||||||
h.hashes[index] = nil
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
copy := hash.hash
|
|
||||||
h.hashes[index] = ©
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append adds a new Hash element to the end of the slice.
|
|
||||||
func (h *NullableHashes) Append(hash *Hash) {
|
|
||||||
if hash == nil {
|
|
||||||
h.hashes = append(h.hashes, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
copy := hash.hash
|
|
||||||
h.hashes = append(h.hashes, ©)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Address represents the 20 byte address of an Ethereum account.
|
// Address represents the 20 byte address of an Ethereum account.
|
||||||
type Address struct {
|
type Address struct {
|
||||||
address common.Address
|
address common.Address
|
||||||
|
|
|
||||||
|
|
@ -85,12 +85,12 @@ func (p *SyncProgress) GetPulledStates() int64 { return int64(p.progress.Pulled
|
||||||
func (p *SyncProgress) GetKnownStates() int64 { return int64(p.progress.KnownStates) }
|
func (p *SyncProgress) GetKnownStates() int64 { return int64(p.progress.KnownStates) }
|
||||||
|
|
||||||
// Topics is a set of topic lists to filter events with.
|
// Topics is a set of topic lists to filter events with.
|
||||||
type Topics struct{ topics [][]*common.Hash }
|
type Topics struct{ topics [][]common.Hash }
|
||||||
|
|
||||||
// NewTopics creates a slice of uninitialized Topics.
|
// NewTopics creates a slice of uninitialized Topics.
|
||||||
func NewTopics(size int) *Topics {
|
func NewTopics(size int) *Topics {
|
||||||
return &Topics{
|
return &Topics{
|
||||||
topics: make([][]*common.Hash, size),
|
topics: make([][]common.Hash, size),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,15 +105,15 @@ func (t *Topics) Size() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the topic list at the given index from the slice.
|
// Get returns the topic list at the given index from the slice.
|
||||||
func (t *Topics) Get(index int) (hashes *NullableHashes, _ error) {
|
func (t *Topics) Get(index int) (hashes *Hashes, _ error) {
|
||||||
if index < 0 || index >= len(t.topics) {
|
if index < 0 || index >= len(t.topics) {
|
||||||
return nil, errors.New("index out of bounds")
|
return nil, errors.New("index out of bounds")
|
||||||
}
|
}
|
||||||
return &NullableHashes{t.topics[index]}, nil
|
return &Hashes{t.topics[index]}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set sets the topic list at the given index in the slice.
|
// Set sets the topic list at the given index in the slice.
|
||||||
func (t *Topics) Set(index int, topics *NullableHashes) error {
|
func (t *Topics) Set(index int, topics *Hashes) error {
|
||||||
if index < 0 || index >= len(t.topics) {
|
if index < 0 || index >= len(t.topics) {
|
||||||
return errors.New("index out of bounds")
|
return errors.New("index out of bounds")
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +122,7 @@ func (t *Topics) Set(index int, topics *NullableHashes) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append adds a new topic list to the end of the slice.
|
// Append adds a new topic list to the end of the slice.
|
||||||
func (t *Topics) Append(topics *NullableHashes) {
|
func (t *Topics) Append(topics *Hashes) {
|
||||||
t.topics = append(t.topics, topics.hashes)
|
t.topics = append(t.topics, topics.hashes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue