Skip to content

Commit

Permalink
refactor: make bootStrapLoaded private and add a getter
Browse files Browse the repository at this point in the history
Signed-off-by: HashEngineering <[email protected]>
  • Loading branch information
HashEngineering committed Jul 12, 2024
1 parent 2c8bd40 commit a559bca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 10 additions & 6 deletions core/src/main/java/org/bitcoinj/evolution/AbstractQuorumState.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ boolean initChainTipSyncComplete() {
String bootstrapFilePath = null;
InputStream bootstrapStream = null;
int bootStrapFileFormat = 0;
public SettableFuture<Boolean> bootStrapLoaded;
private SettableFuture<Boolean> bootStrapLoaded;

boolean isLoadingBootstrap = false;
protected static Random random = new Random();

public AbstractQuorumState(Context context) {
protected AbstractQuorumState(Context context) {
super(context.getParams());
this.context = context;
initializeOnce();
initialize();
}

public AbstractQuorumState(NetworkParameters params, byte[] payload, int offset, int protocolVersion) {
protected AbstractQuorumState(NetworkParameters params, byte[] payload, int offset, int protocolVersion) {
super(params, payload, offset, protocolVersion);
initialize();
}
Expand Down Expand Up @@ -200,6 +200,10 @@ public boolean reachedMaxFailedAttempts() {
return failedAttempts > MAX_ATTEMPTS;
}

public SettableFuture<Boolean> getBootStrapLoadedFuture() {
return bootStrapLoaded;
}

abstract int getBlockHeightOffset();

public abstract int getUpdateInterval();
Expand Down Expand Up @@ -231,13 +235,13 @@ public void retryLastUpdate(Peer peer) {

public abstract SimplifiedMasternodeList getMasternodeListAtTip();

public abstract LinkedHashMap<Sha256Hash, SimplifiedMasternodeList> getMasternodeListCache();
public abstract Map<Sha256Hash, SimplifiedMasternodeList> getMasternodeListCache();

public abstract LinkedHashMap<Sha256Hash, SimplifiedQuorumList> getQuorumsCache();
public abstract Map<Sha256Hash, SimplifiedQuorumList> getQuorumsCache();

public abstract SimplifiedQuorumList getQuorumListAtTip();

public abstract ArrayList<Masternode> getAllQuorumMembers(LLMQParameters.LLMQType llmqType, Sha256Hash blockHash);
public abstract List<Masternode> getAllQuorumMembers(LLMQParameters.LLMQType llmqType, Sha256Hash blockHash);

public void resetMNList() {
resetMNList(false, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ public StoredBlock getBlockTip() {
}

public void waitForBootstrapLoaded() throws ExecutionException, InterruptedException {
if (quorumState.bootStrapLoaded != null) {
quorumState.bootStrapLoaded.get();
if (quorumState.getBootStrapLoadedFuture() != null) {
quorumState.getBootStrapLoadedFuture().get();
}
if (quorumRotationState.bootStrapLoaded != null) {
quorumRotationState.bootStrapLoaded.get();
if (quorumRotationState.getBootStrapLoadedFuture() != null) {
quorumRotationState.getBootStrapLoadedFuture().get();
}
}

Expand Down

0 comments on commit a559bca

Please sign in to comment.