chore(Account):remove setShardProvider on constructor

crossShard
neeboo 5 years ago
parent 94a633213d
commit a39d0cea85
  1. 3
      packages/harmony-account/src/account.ts
  2. 3
      packages/harmony-network/src/messenger/messenger.ts

@ -162,7 +162,6 @@ class Account {
async updateBalances(blockNumber: string = 'latest'): Promise<void> { async updateBalances(blockNumber: string = 'latest'): Promise<void> {
// this.messenger.setShardingProviders(); // this.messenger.setShardingProviders();
const shardProviders = this.messenger.shardProviders; const shardProviders = this.messenger.shardProviders;
if (shardProviders.size > 1) { if (shardProviders.size > 1) {
for (const [name, val] of shardProviders) { for (const [name, val] of shardProviders) {
const balanceObject = await this.getShardBalance(val.shardID, blockNumber); const balanceObject = await this.getShardBalance(val.shardID, blockNumber);
@ -248,12 +247,14 @@ class Account {
this.messenger.chainPrefix, this.messenger.chainPrefix,
shardID, shardID,
); );
const nonce = await this.messenger.send( const nonce = await this.messenger.send(
RPCMethod.GetTransactionCount, RPCMethod.GetTransactionCount,
[this.address, blockNumber], [this.address, blockNumber],
this.messenger.chainPrefix, this.messenger.chainPrefix,
shardID, shardID,
); );
if (balance.isError()) { if (balance.isError()) {
throw balance.error.message; throw balance.error.message;
} }

@ -70,7 +70,7 @@ class Messenger extends HarmonyCore {
// set shardingProviders // set shardingProviders
this.shardProviders = new Map(); this.shardProviders = new Map();
this.setShardingProviders(); // this.setShardingProviders();
} }
get currentShard(): number | undefined { get currentShard(): number | undefined {
return this.getCurrentShardID(); return this.getCurrentShardID();
@ -266,6 +266,7 @@ class Messenger extends HarmonyCore {
} }
try { try {
const response = await this.send(RPCMethod.GetShardingStructure, [], this.chainPrefix); const response = await this.send(RPCMethod.GetShardingStructure, [], this.chainPrefix);
if (response.result) { if (response.result) {
const shardingStructures: ShardingItem[] = response.result; const shardingStructures: ShardingItem[] = response.result;
for (const shard of shardingStructures) { for (const shard of shardingStructures) {

Loading…
Cancel
Save