Skip to content

Commit

Permalink
<fix>(console): fix console extension lose when switch group. (#838)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay authored Mar 19, 2024
1 parent c2b56ee commit f1fbe87
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/console/ConsoleInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class ConsoleInitializer {
private LineReader lineReader;
private boolean useV1TxService;

// v2 transaction extension
private byte[] extension;

public LineReader getLineReader() {
return lineReader;
}
Expand Down Expand Up @@ -76,7 +79,6 @@ public void init(String[] args) throws ConfigException {
logger.info("use v1 transaction service");
useV1TxService = true;
}
byte[] extension = null;
if (args.length > 3 && "-v2".equals(args[3])) {
logger.info("use v2 transaction service");
useV1TxService = true;
Expand Down Expand Up @@ -294,6 +296,9 @@ public void switchGroup(String[] params) {
this.consoleClientFace = new ConsoleClientImpl(client);
this.precompiledFace = new PrecompiledImpl(client);
this.consoleContractFace = new ConsoleContractImpl(client, useV1TxService);
if (extension != null) {
((ConsoleContractImpl) this.consoleContractFace).setExtension(extension);
}
this.collaborationFace = new CollaborationImpl(client);
this.authFace = new AuthImpl(client);
JlineUtils.switchGroup(client);
Expand Down Expand Up @@ -368,6 +373,9 @@ public void loadAccount(String[] params) {
this.consoleClientFace = new ConsoleClientImpl(client);
this.precompiledFace = new PrecompiledImpl(client);
this.consoleContractFace = new ConsoleContractImpl(client, useV1TxService);
if (extension != null) {
((ConsoleContractImpl) this.consoleContractFace).setExtension(extension);
}
this.collaborationFace = new CollaborationImpl(client);
this.authFace = new AuthImpl(client);
System.out.println("Load account " + params[1] + " success!");
Expand Down

0 comments on commit f1fbe87

Please sign in to comment.