mirror of https://github.com/embarklabs/embark.git
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:
parent
0503bb24a3
commit
7e707616be
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
})();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue