Merge pull request #4551 from oscarguindzberg/replaceBitcoinjDeprecated

Replace deprecated bitcoinj methods
This commit is contained in:
sqrrm 2020-09-25 11:29:56 +02:00 committed by GitHub
commit a2a284ef94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 12 deletions

View file

@ -211,7 +211,7 @@ public final class AddressEntryList implements UserThreadMappedPersistableEnvelo
private void maybeAddNewAddressEntry(Transaction tx) {
tx.getOutputs().stream()
.filter(output -> output.isMine(wallet))
.map(output -> output.getAddressFromP2PKHScript(wallet.getNetworkParameters()))
.map(output -> output.getScriptPubKey().getToAddress(wallet.getNetworkParameters()))
.filter(Objects::nonNull)
.filter(this::isAddressNotInEntries)
.map(address -> (DeterministicKey) wallet.findKeyFromPubKeyHash(address.getHash(),

View file

@ -146,16 +146,12 @@ public class DelayedPayoutTxValidation {
NetworkParameters params = btcWalletService.getParams();
Address address = output.getAddressFromP2PKHScript(params);
Address address = output.getScriptPubKey().getToAddress(params);
if (address == null) {
// The donation address can be as well be a multisig address.
address = output.getAddressFromP2SH(params);
if (address == null) {
errorMsg = "Donation address cannot be resolved (not of type P2PKHScript or P2SH). Output: " + output;
log.error(errorMsg);
log.error(delayedPayoutTx.toString());
throw new DonationAddressException(errorMsg);
}
errorMsg = "Donation address cannot be resolved (not of type P2PK nor P2SH nor P2WH). Output: " + output;
log.error(errorMsg);
log.error(delayedPayoutTx.toString());
throw new DonationAddressException(errorMsg);
}
String addressAsString = address.toString();

View file

@ -59,7 +59,7 @@ public class BuyerSetupDepositTxListener extends TradeTask {
final NetworkParameters params = walletService.getParams();
Transaction preparedDepositTx = new Transaction(params, processModel.getPreparedDepositTx());
checkArgument(!preparedDepositTx.getOutputs().isEmpty(), "preparedDepositTx.getOutputs() must not be empty");
Address depositTxAddress = preparedDepositTx.getOutput(0).getAddressFromP2SH(params);
Address depositTxAddress = preparedDepositTx.getOutput(0).getScriptPubKey().getToAddress(params);
final TransactionConfidence confidence = walletService.getConfidenceForAddress(depositTxAddress);
if (isInNetwork(confidence)) {
applyConfidence(confidence);

View file

@ -157,7 +157,7 @@ class TransactionAwareTrade implements TransactionAwareTradable {
tx.getOutputs().forEach(txo -> {
if (btcWalletService.isTransactionOutputMine(txo)) {
try {
Address receiverAddress = txo.getAddressFromP2PKHScript(btcWalletService.getParams());
Address receiverAddress = txo.getScriptPubKey().getToAddress(btcWalletService.getParams());
Contract contract = checkNotNull(trade.getContract());
String myPayoutAddressString = contract.isMyRoleBuyer(pubKeyRing) ?
contract.getBuyerPayoutAddressString() :