Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<fix>(console): fix console extension lose when switch group. #838

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading