use of bisq.core.btc.wallet.TxMalleabilityException in project bisq-core by bisq-network.
the class LockupService method publishLockupTx.
public void publishLockupTx(Coin lockupAmount, int lockTime, LockupType lockupType, BondedRole bondedRole, ResultHandler resultHandler, ExceptionHandler exceptionHandler) {
checkArgument(lockTime <= BondingConsensus.getMaxLockTime() && lockTime >= BondingConsensus.getMinLockTime(), "lockTime not in rage");
try {
byte[] hash = BondingConsensus.getHash(lockupType, bondedRole);
byte[] opReturnData = BondingConsensus.getLockupOpReturnData(lockTime, lockupType, hash);
final Transaction lockupTx = getLockupTx(lockupAmount, opReturnData);
// noinspection Duplicates
walletsManager.publishAndCommitBsqTx(lockupTx, new TxBroadcaster.Callback() {
@Override
public void onSuccess(Transaction transaction) {
resultHandler.handleResult();
}
@Override
public void onTxMalleability(TxMalleabilityException exception) {
exceptionHandler.handleException(exception);
}
@Override
public void onFailure(TxBroadcastException exception) {
exceptionHandler.handleException(exception);
}
});
} catch (TransactionVerificationException | InsufficientMoneyException | WalletException | IOException exception) {
exceptionHandler.handleException(exception);
}
}
use of bisq.core.btc.wallet.TxMalleabilityException in project bisq-core by bisq-network.
the class UnlockService method publishUnlockTx.
public void publishUnlockTx(String lockupTxId, ResultHandler resultHandler, ExceptionHandler exceptionHandler) {
try {
TxOutput lockupTxOutput = bsqStateService.getLockupTxOutput(lockupTxId).get();
final Transaction unlockTx = getUnlockTx(lockupTxOutput);
// noinspection Duplicates
walletsManager.publishAndCommitBsqTx(unlockTx, new TxBroadcaster.Callback() {
@Override
public void onSuccess(Transaction transaction) {
resultHandler.handleResult();
}
@Override
public void onTxMalleability(TxMalleabilityException exception) {
exceptionHandler.handleException(exception);
}
@Override
public void onFailure(TxBroadcastException exception) {
exceptionHandler.handleException(exception);
}
});
} catch (TransactionVerificationException | InsufficientMoneyException | WalletException exception) {
exceptionHandler.handleException(exception);
}
}
Aggregations