Update Guava to 27.0.1-android.

This commit is contained in:
Andreas Schildbach
2019-02-14 23:20:55 +01:00
parent b5517a1b70
commit f24a4aa19a
18 changed files with 36 additions and 24 deletions

View File

@@ -10,7 +10,7 @@ eclipse.project.name = 'bitcoinj-core'
dependencies {
compile 'org.bouncycastle:bcprov-jdk15on:1.60'
implementation 'com.lambdaworks:scrypt:1.4.0'
implementation 'com.google.guava:guava:25.1-android'
implementation 'com.google.guava:guava:27.0.1-android'
compile 'com.google.protobuf:protobuf-java:3.5.1'
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation 'org.slf4j:slf4j-api:1.7.25'

View File

@@ -33,6 +33,7 @@ import com.google.common.collect.Lists;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import net.jcip.annotations.GuardedBy;
import org.slf4j.Logger;
@@ -167,7 +168,7 @@ public class Peer extends PeerSocketHandler {
checkState(peers.size() == 2 && peers.get(0) == peers.get(1));
return peers.get(0);
}
});
}, MoreExecutors.directExecutor());
/**
* <p>Construct a peer that reads/writes from the given block chain.</p>
@@ -847,7 +848,7 @@ public class Peer extends PeerSocketHandler {
log.error("Error was: ", throwable);
// Not much more we can do at this point.
}
});
}, MoreExecutors.directExecutor());
} else {
wallet.receivePending(tx, null);
}
@@ -907,7 +908,7 @@ public class Peer extends PeerSocketHandler {
public void onFailure(Throwable throwable) {
resultFuture.setException(throwable);
}
});
}, MoreExecutors.directExecutor());
return resultFuture;
}
@@ -971,7 +972,7 @@ public class Peer extends PeerSocketHandler {
public void onFailure(Throwable throwable) {
resultFuture.setException(throwable);
}
});
}, MoreExecutors.directExecutor());
}
}
@@ -979,7 +980,7 @@ public class Peer extends PeerSocketHandler {
public void onFailure(Throwable throwable) {
resultFuture.setException(throwable);
}
});
}, MoreExecutors.directExecutor());
// Start the operation.
sendMessage(getdata);
} catch (Exception e) {

View File

@@ -2094,7 +2094,7 @@ public class PeerGroup implements TransactionBroadcaster {
// This can happen if we get a reject message from a peer.
runningBroadcasts.remove(broadcast);
}
});
}, MoreExecutors.directExecutor());
// Keep a reference to the TransactionBroadcast object. This is important because otherwise, the entire tree
// of objects we just created would become garbage if the user doesn't hold on to the returned future, and
// eventually be collected. This in turn could result in the transaction not being committed to the wallet

View File

@@ -387,7 +387,7 @@ public class WalletAppKit extends AbstractIdleService {
throw new RuntimeException(t);
}
});
}, MoreExecutors.directExecutor());
}
} catch (BlockStoreException e) {
throw new IOException(e);

View File

@@ -111,7 +111,7 @@ public class NioClient implements MessageWriteTarget {
public void onFailure(Throwable t) {
log.error("Connect to {} failed: {}", serverAddress, Throwables.getRootCause(t));
}
});
}, MoreExecutors.directExecutor());
}
@Override

View File

@@ -22,6 +22,8 @@ import com.google.common.collect.Multimap;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import org.bitcoinj.core.*;
import org.bitcoinj.crypto.TransactionSignature;
import org.bitcoinj.protocols.channels.IPaymentChannelClient.ClientChannelProperties;
@@ -188,7 +190,7 @@ public abstract class PaymentChannelClientState {
public void onFailure(Throwable t) {
Throwables.propagate(t);
}
});
}, MoreExecutors.directExecutor());
}
private synchronized void deleteChannelFromWallet() {

View File

@@ -26,6 +26,7 @@ import org.bitcoinj.wallet.Wallet;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.ByteString;
import net.jcip.annotations.GuardedBy;
import org.bitcoin.paymentchannel.Protos;
@@ -457,7 +458,7 @@ public class PaymentChannelServer {
log.info("Failed retrieving paymentIncrease info future");
error("Failed processing payment update", Protos.Error.ErrorCode.OTHER, CloseReason.UPDATE_PAYMENT_FAILED);
}
});
}, MoreExecutors.directExecutor());
}
}
@@ -561,7 +562,7 @@ public class PaymentChannelServer {
public ListenableFuture<Transaction> apply(KeyParameter userKey) throws Exception {
return state.close(userKey);
}
});
}, MoreExecutors.directExecutor());
} else {
result = state.close();
}
@@ -588,7 +589,7 @@ public class PaymentChannelServer {
log.error("Failed to broadcast settlement tx", t);
conn.destroyConnection(clientRequestedClose);
}
});
}, MoreExecutors.directExecutor());
}
/**

View File

@@ -24,6 +24,7 @@ import com.google.common.collect.Multimap;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.bitcoinj.core.*;
import org.bitcoinj.crypto.TransactionSignature;
@@ -212,7 +213,7 @@ public abstract class PaymentChannelServerState {
stateMachine.transition(State.ERROR);
future.setException(throwable);
}
});
}, MoreExecutors.directExecutor());
return future;
}

View File

@@ -27,6 +27,7 @@ import org.bitcoinj.wallet.Wallet;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -261,7 +262,7 @@ public class PaymentChannelV1ServerState extends PaymentChannelServerState {
stateMachine.transition(State.ERROR);
closedFuture.setException(throwable);
}
});
}, MoreExecutors.directExecutor());
return closedFuture;
}

View File

@@ -21,6 +21,7 @@ import com.google.common.collect.MultimapBuilder;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.bitcoinj.core.*;
import org.bitcoinj.crypto.TransactionSignature;
@@ -215,7 +216,7 @@ public class PaymentChannelV2ServerState extends PaymentChannelServerState {
stateMachine.transition(State.ERROR);
closedFuture.setException(throwable);
}
});
}, MoreExecutors.directExecutor());
return closedFuture;
}
}

View File

@@ -5289,7 +5289,7 @@ public class Wallet extends BaseTaggableObject
public void onFailure(Throwable throwable) {
log.error("Failed to broadcast key rotation tx", throwable);
}
});
}, MoreExecutors.directExecutor());
} catch (Exception e) {
log.error("Failed to broadcast rekey tx", e);
}

View File

@@ -22,6 +22,7 @@ import org.bitcoinj.wallet.Wallet;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import java.util.concurrent.LinkedBlockingQueue;
@@ -88,7 +89,7 @@ public class MockTransactionBroadcaster implements TransactionBroadcaster {
@Override
public void onFailure(Throwable t) {
}
});
}, MoreExecutors.directExecutor());
return TransactionBroadcast.createMockBroadcast(tx, result);
} catch (InterruptedException e) {
throw new RuntimeException(e);