fix(wallet): use mnemonic displayed check for 'findNewBlocksCommand'
Fixed some tests to use wrong sql DB for account DB
This commit is contained in:
parent
761aa64e04
commit
b8c006843b
|
@ -54,7 +54,25 @@ func (c *findNewBlocksCommand) Run(parent context.Context) (err error) {
|
|||
|
||||
func (c *findNewBlocksCommand) findAndSaveEthBlocks(parent context.Context, fromNum, headNum *big.Int) {
|
||||
// Check ETH transfers for each account independently
|
||||
mnemonicWasNotShown, err := c.accountsDB.GetMnemonicWasNotShown()
|
||||
if err != nil {
|
||||
c.error = err
|
||||
return
|
||||
}
|
||||
|
||||
for _, account := range c.accounts {
|
||||
if mnemonicCheckEnabled && mnemonicWasNotShown {
|
||||
acc, err := c.accountsDB.GetAccountByAddress(nodetypes.Address(account))
|
||||
if err != nil {
|
||||
c.error = err
|
||||
return
|
||||
}
|
||||
if acc.AddressWasNotShown {
|
||||
log.Info("skip findNewBlocksCommand, mnemonic has not been shown and the address has not been shared yet", "address", account)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
log.Debug("start findNewBlocksCommand", "account", account, "chain", c.chainClient.NetworkID(), "noLimit", c.noLimit, "from", fromNum, "to", headNum)
|
||||
|
||||
headers, startBlockNum, _ := c.findBlocksWithEthTransfers(parent, account, fromNum, headNum)
|
||||
|
|
|
@ -1076,7 +1076,7 @@ func TestFetchTransfersForLoadedBlocks(t *testing.T) {
|
|||
address := common.HexToAddress("0x1234")
|
||||
chainClient := newMockChainClient()
|
||||
tracker := transactions.NewPendingTxTracker(db, chainClient, nil, &event.Feed{}, transactions.PendingCheckInterval)
|
||||
accDB, err := accounts.NewDB(wdb.client)
|
||||
accDB, err := accounts.NewDB(appdb)
|
||||
require.NoError(t, err)
|
||||
|
||||
cmd := &loadBlocksAndTransfersCommand{
|
||||
|
@ -1153,7 +1153,7 @@ func TestFetchNewBlocksCommand_findBlocksWithEthTransfers(t *testing.T) {
|
|||
blockChannel := make(chan []*DBHeader, 10)
|
||||
|
||||
address := common.HexToAddress("0x1234")
|
||||
accDB, err := accounts.NewDB(wdb.client)
|
||||
accDB, err := accounts.NewDB(appdb)
|
||||
require.NoError(t, err)
|
||||
|
||||
for idx, testCase := range getNewBlocksCases() {
|
||||
|
@ -1229,7 +1229,7 @@ func TestFetchNewBlocksCommand(t *testing.T) {
|
|||
|
||||
address1 := common.HexToAddress("0x1234")
|
||||
address2 := common.HexToAddress("0x5678")
|
||||
accDB, err := accounts.NewDB(wdb.client)
|
||||
accDB, err := accounts.NewDB(appdb)
|
||||
require.NoError(t, err)
|
||||
|
||||
tc := &TestClient{
|
||||
|
|
Loading…
Reference in New Issue