Make sure context is set after it is properly initialized

This commit is contained in:
Christian Basler 2017-01-11 17:30:04 +01:00
parent 732032b1b5
commit 3f8980e236

View File

@ -66,13 +66,13 @@ public class BitmessageContext {
private final boolean sendPubkeyOnIdentityCreation; private final boolean sendPubkeyOnIdentityCreation;
private BitmessageContext(Builder builder) { private BitmessageContext(Builder builder) {
if (builder.listener instanceof Listener.WithContext) {
((Listener.WithContext) builder.listener).setContext(this);
}
ctx = new InternalContext(builder); ctx = new InternalContext(builder);
labeler = builder.labeler; labeler = builder.labeler;
ctx.getProofOfWorkService().doMissingProofOfWork(30_000); // TODO: this should be configurable ctx.getProofOfWorkService().doMissingProofOfWork(30_000); // TODO: this should be configurable
sendPubkeyOnIdentityCreation = builder.sendPubkeyOnIdentityCreation; sendPubkeyOnIdentityCreation = builder.sendPubkeyOnIdentityCreation;
if (builder.listener instanceof Listener.WithContext) {
((Listener.WithContext) builder.listener).setContext(this);
}
} }
public AddressRepository addresses() { public AddressRepository addresses() {