mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
bitcoinj 0.15: Replace deprecated Script methods with ScriptPattern methods.
This commit is contained in:
parent
08cc836bab
commit
d8e0ba752f
@ -45,6 +45,7 @@ import org.bitcoinj.core.TransactionInput;
|
||||
import org.bitcoinj.core.TransactionOutput;
|
||||
import org.bitcoinj.crypto.TransactionSignature;
|
||||
import org.bitcoinj.script.ScriptChunk;
|
||||
import org.bitcoinj.script.ScriptPattern;
|
||||
import org.bitcoinj.wallet.RiskAnalysis;
|
||||
import org.bitcoinj.wallet.Wallet;
|
||||
|
||||
@ -198,7 +199,7 @@ public class BisqRiskAnalysis implements RiskAnalysis {
|
||||
*/
|
||||
public static RuleViolation isOutputStandard(TransactionOutput output) {
|
||||
// OP_RETURN has usually output value zero, so we exclude that from the MIN_ANALYSIS_NONDUST_OUTPUT check
|
||||
if (!output.getScriptPubKey().isOpReturn()
|
||||
if (!ScriptPattern.isOpReturn(output.getScriptPubKey())
|
||||
&& output.getValue().compareTo(MIN_ANALYSIS_NONDUST_OUTPUT) < 0)
|
||||
return RuleViolation.DUST;
|
||||
for (ScriptChunk chunk : output.getScriptPubKey().getChunks()) {
|
||||
|
@ -49,6 +49,7 @@ import org.bitcoinj.crypto.DeterministicKey;
|
||||
import org.bitcoinj.crypto.TransactionSignature;
|
||||
import org.bitcoinj.script.Script;
|
||||
import org.bitcoinj.script.ScriptBuilder;
|
||||
import org.bitcoinj.script.ScriptPattern;
|
||||
import org.bitcoinj.wallet.SendRequest;
|
||||
import org.bitcoinj.wallet.Wallet;
|
||||
|
||||
@ -1169,9 +1170,9 @@ public class TradeWalletService {
|
||||
Sha256Hash hash = transaction.hashForSignature(inputIndex, scriptPubKey, Transaction.SigHash.ALL, false);
|
||||
ECKey.ECDSASignature signature = sigKey.sign(hash, aesKey);
|
||||
TransactionSignature txSig = new TransactionSignature(signature, Transaction.SigHash.ALL, false);
|
||||
if (scriptPubKey.isSentToRawPubKey()) {
|
||||
if (ScriptPattern.isP2PK(scriptPubKey)) {
|
||||
input.setScriptSig(ScriptBuilder.createInputScript(txSig));
|
||||
} else if (scriptPubKey.isSentToAddress()) {
|
||||
} else if (ScriptPattern.isP2PKH(scriptPubKey)) {
|
||||
input.setScriptSig(ScriptBuilder.createInputScript(txSig, sigKey));
|
||||
} else {
|
||||
throw new SigningException("Don't know how to sign for this kind of scriptPubKey: " + scriptPubKey);
|
||||
|
@ -735,8 +735,8 @@ public abstract class WalletService {
|
||||
}
|
||||
|
||||
public static boolean isOutputScriptConvertibleToAddress(TransactionOutput output) {
|
||||
return output.getScriptPubKey().isSentToAddress() ||
|
||||
output.getScriptPubKey().isPayToScriptHash();
|
||||
return ScriptPattern.isP2PKH(output.getScriptPubKey()) ||
|
||||
ScriptPattern.isP2SH(output.getScriptPubKey());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -32,6 +32,7 @@ import org.bitcoinj.core.Sha256Hash;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.bitcoinj.core.TransactionInput;
|
||||
import org.bitcoinj.core.TransactionOutput;
|
||||
import org.bitcoinj.script.ScriptPattern;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@ -102,7 +103,7 @@ public abstract class BondRepository<T extends Bond, R extends BondedAsset> impl
|
||||
public static boolean isLockupTxUnconfirmed(BsqWalletService bsqWalletService, BondedAsset bondedAsset) {
|
||||
return bsqWalletService.getPendingWalletTransactionsStream()
|
||||
.map(transaction -> transaction.getOutputs().get(transaction.getOutputs().size() - 1))
|
||||
.filter(lastOutput -> lastOutput.getScriptPubKey().isOpReturn())
|
||||
.filter(lastOutput -> ScriptPattern.isOpReturn(lastOutput.getScriptPubKey()))
|
||||
.map(lastOutput -> lastOutput.getScriptPubKey().getChunks())
|
||||
.filter(chunks -> chunks.size() > 1)
|
||||
.map(chunks -> chunks.get(1).data)
|
||||
|
Loading…
Reference in New Issue
Block a user