[#4640] Temporary fetch l2 block number for Arbitrum networks separately from BalanceChecker (#4644)
This commit is contained in:
parent
0808b780f7
commit
dad2ec3f66
|
@ -20,6 +20,7 @@ import (
|
||||||
"github.com/status-im/status-go/services/wallet/async"
|
"github.com/status-im/status-go/services/wallet/async"
|
||||||
"github.com/status-im/status-go/services/wallet/balance"
|
"github.com/status-im/status-go/services/wallet/balance"
|
||||||
"github.com/status-im/status-go/services/wallet/blockchainstate"
|
"github.com/status-im/status-go/services/wallet/blockchainstate"
|
||||||
|
walletcommon "github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/services/wallet/token"
|
"github.com/status-im/status-go/services/wallet/token"
|
||||||
"github.com/status-im/status-go/services/wallet/walletevent"
|
"github.com/status-im/status-go/services/wallet/walletevent"
|
||||||
"github.com/status-im/status-go/transactions"
|
"github.com/status-im/status-go/transactions"
|
||||||
|
@ -71,6 +72,19 @@ func (c *findNewBlocksCommand) detectTransfers(parent context.Context, accounts
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
networkID := c.chainClient.NetworkID()
|
||||||
|
// TODO(rasom): remove this as soon as BalanceChecker contract for
|
||||||
|
// Arbitrum networks will return l2 block number instead of l1
|
||||||
|
if networkID == walletcommon.ArbitrumMainnet || networkID == walletcommon.ArbitrumGoerli || networkID == walletcommon.ArbitrumSepolia {
|
||||||
|
header, err := c.chainClient.HeaderByNumber(context.Background(), nil)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("findNewBlocksCommand error getting header", "error", err, "chain", c.chainClient.NetworkID())
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
blockNum = header.Number
|
||||||
|
}
|
||||||
|
|
||||||
addressesToCheck := []common.Address{}
|
addressesToCheck := []common.Address{}
|
||||||
for idx, account := range accounts {
|
for idx, account := range accounts {
|
||||||
blockRange, err := c.blockRangeDAO.getBlockRange(c.chainClient.NetworkID(), account)
|
blockRange, err := c.blockRangeDAO.getBlockRange(c.chainClient.NetworkID(), account)
|
||||||
|
|
Loading…
Reference in New Issue