Adapting for Ethereum as a library style:
+ using block queue buffer as indication that the blockchain loading is in process
This commit is contained in:
parent
92fe4bae0e
commit
79dc226d76
|
@ -67,6 +67,8 @@ public interface Ethereum {
|
|||
|
||||
public Blockchain getBlockChain();
|
||||
|
||||
public boolean isBlockChainLoading();
|
||||
|
||||
public void addListener(EthereumListener listener);
|
||||
|
||||
public void loadBlockChain();
|
||||
|
|
|
@ -137,6 +137,10 @@ public class EthereumImpl implements Ethereum {
|
|||
WorldManager.getInstance().loadBlockchain();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockChainLoading() {
|
||||
return WorldManager.getInstance().isBlockChainLoading();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
|
|
@ -164,6 +164,14 @@ public class WorldManager {
|
|||
}
|
||||
|
||||
|
||||
public boolean isBlockChainLoading(){
|
||||
|
||||
if (blockchain.getBlockQueue().size() > 2)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
stopPeerDiscovery();
|
||||
repository.close();
|
||||
|
|
|
@ -147,6 +147,12 @@ class PayOutDialog extends JDialog implements MessageAwareDialog {
|
|||
|
||||
private boolean validInput() {
|
||||
|
||||
if (UIEthereumManager.ethereum.isBlockChainLoading()){
|
||||
alertStatusMsg("No transaction is allowed during block chain downloading.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
String receiverText = receiverInput.getText();
|
||||
if (receiverText == null || receiverText.isEmpty()) {
|
||||
alertStatusMsg("Should specify valid receiver address");
|
||||
|
|
Loading…
Reference in New Issue