Skip to content

Commit 0fc8f98

Browse files
committed
Fix GUI issue trying to join peer with locked key
1 parent 47e9f56 commit 0fc8f98

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

convex-gui/src/main/java/convex/gui/peer/PeerGUI.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,19 @@ public static PeerGUI launchPeerGUI(int peerNum, AKeyPair genesisKey) throws Int
8888
return manager;
8989
}
9090

91-
public static PeerGUI launchPeerGUI(InetSocketAddress sa, AWalletEntry we) throws InterruptedException, PeerException {
91+
/**
92+
* LAunch a peer, joining an existing network
93+
* @param sa Socket address of source peer to sync with
94+
* @param kp Key pair for new peer
95+
* @return
96+
* @throws InterruptedException
97+
* @throws PeerException
98+
*/
99+
public static PeerGUI launchPeerGUI(InetSocketAddress sa, AKeyPair kp) throws InterruptedException, PeerException {
92100
DefaultListModel<ConvexLocal> peerList=new DefaultListModel<>();
93101

94102
HashMap<Keyword, Object> config=new HashMap<>();
95-
config.put(Keywords.KEYPAIR,we.getKeyPair());
103+
config.put(Keywords.KEYPAIR,kp);
96104
config.put(Keywords.SOURCE,sa);
97105
Server server=API.launchPeer(config);
98106
ConvexLocal convex=ConvexLocal.connect(server);

convex-gui/src/main/java/convex/gui/peer/PeerLaunchDialog.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,15 @@ public static void runLaunchDialog(JComponent parent) {
126126

127127
AWalletEntry we=peerKeyField.getWalletEntry();
128128
if (we==null) throw new IllegalArgumentException("No peer key selected");
129+
if (we.isLocked()) {
130+
boolean unlocked= UnlockWalletDialog.offerUnlock(parent,we);
131+
if (!unlocked) {
132+
Toast.display(parent, "Launch cancelled: Locked peer key", Color.RED);
133+
return;
134+
}
135+
}
129136

130-
PeerGUI.launchPeerGUI(sa,we);
137+
PeerGUI.launchPeerGUI(sa,we.getKeyPair());
131138
} else if (selected==loadPanel) {
132139
File f=backupPicker.getFile();
133140
AKeyPair kp=null; // TODO;

convex-gui/src/main/java/convex/gui/tools/MessageFormatPanel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public MessageFormatPanel() {
5959

6060
dataArea = new CodePane();
6161
dataArea.setToolTipText("Enter data objects here");
62+
dataArea.setEditable(true);
6263
dataArea.setMaxColumns(128);
6364
dataArea.setFont(Toolkit.MONO_FONT);
6465
// dataArea.setLineWrap(true);

0 commit comments

Comments
 (0)