Skip to content

Commit

Permalink
feat: remove representatives rpc call from import-accounts-meta
Browse files Browse the repository at this point in the history
  • Loading branch information
mistakia committed Apr 3, 2024
1 parent f353501 commit c69002a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
5 changes: 3 additions & 2 deletions common/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ const rpcAccountInfo = ({
representative = false,
pending = false,
include_confirmed = false,
timeout = 20000
timeout = 20000,
weight = true
} = {}) => {
const data = {
action: 'account_info',
weight: true,
weight,
representative,
include_confirmed,
pending,
Expand Down
14 changes: 5 additions & 9 deletions scripts/import-accounts-meta.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ debug.enable('import-accounts-meta')
const timestamp = Math.round(Date.now() / 1000)

const importAccountsMeta = async () => {
const { representatives } = await rpc.representatives()
const rows = await db('accounts')
.join(
'accounts_meta_index',
Expand All @@ -34,17 +33,14 @@ const importAccountsMeta = async () => {
break
}

const accountInfo = await rpc.accountInfo({ account, timeout: 5000 })
const accountInfo = await rpc.accountInfo({
account,
timeout: 5000,
weight: true
})
if (!accountInfo || accountInfo.error) {
logger(`unable to get account info for ${account}`)

if (representatives && representatives[account]) {
inserts.push({
account,
timestamp,
weight: representatives[account]
})
}
continue
}

Expand Down

0 comments on commit c69002a

Please sign in to comment.