fix(@embarkrpc-manager): fix infinite loop in eth_accounts modifier

This was caused by the fact that we registered the action to change
the accounts, but that action needs the node accounts, which is
a request to eth_accounts, hence creating a loop
This commit is contained in:
Jonathan Rainville 2019-12-12 14:59:05 -05:00 committed by Iuri Matias
parent 0503bb24a3
commit 7e707616be
2 changed files with 7 additions and 1 deletions

View File

@ -21,6 +21,12 @@ export default class EthAccounts extends RpcModifier {
constructor(embark: Embark, rpcModifierEvents: Events) {
super(embark, rpcModifierEvents);
this.init();
}
private async init() {
await this.nodeAccounts;
this.embark.registerActionForEvent("blockchain:proxy:response", this.ethAccountsResponse.bind(this));
}

View File

@ -44,7 +44,7 @@ export default class RpcModifier {
public set nodeAccounts(nodeAccounts: Promise<any[]>) {
(async () => {
this._nodeAccounts = await nodeAccounts;
// reset accounts backing variable as it neesd to be recalculated
// reset accounts backing variable as it needs to be recalculated
this._accounts = null;
})();
}