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:
romanman 2014-09-06 13:24:43 +03:00
parent 92fe4bae0e
commit 79dc226d76
4 changed files with 20 additions and 0 deletions

View File

@ -67,6 +67,8 @@ public interface Ethereum {
public Blockchain getBlockChain();
public boolean isBlockChainLoading();
public void addListener(EthereumListener listener);
public void loadBlockChain();

View File

@ -137,6 +137,10 @@ public class EthereumImpl implements Ethereum {
WorldManager.getInstance().loadBlockchain();
}
@Override
public boolean isBlockChainLoading() {
return WorldManager.getInstance().isBlockChainLoading();
}
@Override
public void close() {

View File

@ -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();

View File

@ -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");