forked from cerc-io/laconicd-deprecated
rpc: fix range filter fromBlock logic (#643)
This commit is contained in:
parent
06516f7eb3
commit
f9323f6473
@ -58,6 +58,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
* (rpc) [tharsis#642](https://github.com/tharsis/ethermint/issues/642) Fix `eth_getLogs` when string is specified in filter's from or to fields
|
||||||
* (evm) [tharsis#616](https://github.com/tharsis/ethermint/issues/616) Fix halt on deeply nested stack of cache context. Stack is now flattened before iterating over the tx logs.
|
* (evm) [tharsis#616](https://github.com/tharsis/ethermint/issues/616) Fix halt on deeply nested stack of cache context. Stack is now flattened before iterating over the tx logs.
|
||||||
* (rpc, evm) [tharsis#614](https://github.com/tharsis/ethermint/issues/614) Use JSON for (un)marshaling tx `Log`s from events.
|
* (rpc, evm) [tharsis#614](https://github.com/tharsis/ethermint/issues/614) Use JSON for (un)marshaling tx `Log`s from events.
|
||||||
* (rpc) [tharsis#611](https://github.com/tharsis/ethermint/pull/611) Fix panic on JSON-RPC when querying for an invalid block height.
|
* (rpc) [tharsis#611](https://github.com/tharsis/ethermint/pull/611) Fix panic on JSON-RPC when querying for an invalid block height.
|
||||||
|
@ -120,11 +120,15 @@ func (f *Filter) Logs(_ context.Context) ([]*ethtypes.Log, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
head := header.Number.Int64()
|
head := header.Number.Int64()
|
||||||
if f.criteria.FromBlock.Int64() == -1 {
|
if f.criteria.FromBlock.Int64() < 0 {
|
||||||
f.criteria.FromBlock = big.NewInt(head)
|
f.criteria.FromBlock = big.NewInt(head)
|
||||||
|
} else if f.criteria.FromBlock.Int64() == 0 {
|
||||||
|
f.criteria.FromBlock = big.NewInt(1)
|
||||||
}
|
}
|
||||||
if f.criteria.ToBlock.Int64() == -1 {
|
if f.criteria.ToBlock.Int64() < 0 {
|
||||||
f.criteria.ToBlock = big.NewInt(head)
|
f.criteria.ToBlock = big.NewInt(head)
|
||||||
|
} else if f.criteria.ToBlock.Int64() == 0 {
|
||||||
|
f.criteria.ToBlock = big.NewInt(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.criteria.ToBlock.Int64()-f.criteria.FromBlock.Int64() > maxFilterBlocks {
|
if f.criteria.ToBlock.Int64()-f.criteria.FromBlock.Int64() > maxFilterBlocks {
|
||||||
|
Loading…
Reference in New Issue
Block a user