Improve naming, cleanups, use static imports

This commit is contained in:
chimp1984 2021-10-23 21:38:00 +02:00
parent 3276c80d9b
commit d0bb421839
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
2 changed files with 9 additions and 7 deletions

View File

@ -53,10 +53,10 @@ public abstract class ProcessBsqSwapFinalizedTxMessage extends BsqSwapTask {
Transaction buyersTransactionWithoutSigs = protocolModel.getBtcWalletService().getTxFromSerializedTx(message.getTx());
int buyersInputSize = Objects.requireNonNull(protocolModel.getTradePeer().getInputs()).size();
Objects.requireNonNull(buyersTransactionWithoutSigs.getInputs()).stream()
.filter(i -> i.getIndex() < buyersInputSize)
.forEach(i -> {
i.clearScriptBytes();
i.setWitness(TransactionWitness.EMPTY);
.filter(input -> input.getIndex() < buyersInputSize)
.forEach(input -> {
input.clearScriptBytes();
input.setWitness(TransactionWitness.EMPTY);
});
byte[] sellersPartiallySignedTx = protocolModel.getTx();
checkArgument(Arrays.equals(buyersTransactionWithoutSigs.bitcoinSerialize(), sellersPartiallySignedTx),

View File

@ -36,6 +36,9 @@ import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
import static org.bitcoinj.core.TransactionConfidence.ConfidenceType.BUILDING;
import static org.bitcoinj.core.TransactionConfidence.ConfidenceType.PENDING;
@Slf4j
public abstract class SellerSetupTxListener extends BsqSwapTask {
@Nullable
@ -93,7 +96,6 @@ public abstract class SellerSetupTxListener extends BsqSwapTask {
}
}
private boolean processConfidence(TransactionConfidence confidence) {
if (confidence == null) {
return false;
@ -126,8 +128,8 @@ public abstract class SellerSetupTxListener extends BsqSwapTask {
private boolean isInNetwork(TransactionConfidence confidence) {
return confidence != null &&
(confidence.getConfidenceType().equals(TransactionConfidence.ConfidenceType.BUILDING) ||
confidence.getConfidenceType().equals(TransactionConfidence.ConfidenceType.PENDING));
(confidence.getConfidenceType().equals(BUILDING) ||
confidence.getConfidenceType().equals(PENDING));
}
private void cleanup() {