mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-03 09:24:25 +00:00
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) {
|
constructor(embark: Embark, rpcModifierEvents: Events) {
|
||||||
super(embark, rpcModifierEvents);
|
super(embark, rpcModifierEvents);
|
||||||
|
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async init() {
|
||||||
|
await this.nodeAccounts;
|
||||||
|
|
||||||
this.embark.registerActionForEvent("blockchain:proxy:response", this.ethAccountsResponse.bind(this));
|
this.embark.registerActionForEvent("blockchain:proxy:response", this.ethAccountsResponse.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ export default class RpcModifier {
|
|||||||
public set nodeAccounts(nodeAccounts: Promise<any[]>) {
|
public set nodeAccounts(nodeAccounts: Promise<any[]>) {
|
||||||
(async () => {
|
(async () => {
|
||||||
this._nodeAccounts = await nodeAccounts;
|
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;
|
this._accounts = null;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user