diff --git a/src/main/java/console/ConsoleInitializer.java b/src/main/java/console/ConsoleInitializer.java index fde68e61..b33433ce 100644 --- a/src/main/java/console/ConsoleInitializer.java +++ b/src/main/java/console/ConsoleInitializer.java @@ -47,6 +47,9 @@ public class ConsoleInitializer { private LineReader lineReader; private boolean useV1TxService; + // v2 transaction extension + private byte[] extension; + public LineReader getLineReader() { return lineReader; } @@ -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; @@ -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); @@ -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!");