Java Code Examples for org.bitcoinj.core.Transaction#getFee()

The following examples show how to use org.bitcoinj.core.Transaction#getFee() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyBlindVoteListService.java    From bisq-core with GNU Affero General Public License v3.0 5 votes vote down vote up
public Tuple2<Coin, Integer> getMiningFeeAndTxSize(Coin stake)
        throws InsufficientMoneyException, WalletException, TransactionVerificationException {
    // We set dummy opReturn data
    Coin blindVoteFee = BlindVoteConsensus.getFee(bsqStateService, bsqStateService.getChainHeight());
    Transaction dummyTx = getBlindVoteTx(stake, blindVoteFee, new byte[22]);
    Coin miningFee = dummyTx.getFee();
    int txSize = dummyTx.bitcoinSerialize().length;
    return new Tuple2<>(miningFee, txSize);
}
 
Example 2
Source File: UnlockTxService.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public Tuple2<Coin, Integer> getMiningFeeAndTxSize(String lockupTxId)
        throws InsufficientMoneyException, WalletException, TransactionVerificationException {
    Transaction tx = getUnlockTx(lockupTxId);
    Coin miningFee = tx.getFee();
    int txSize = tx.bitcoinSerialize().length;
    return new Tuple2<>(miningFee, txSize);
}
 
Example 3
Source File: LockupTxService.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public Tuple2<Coin, Integer> getMiningFeeAndTxSize(Coin lockupAmount, int lockTime, LockupReason lockupReason, byte[] hash)
        throws InsufficientMoneyException, WalletException, TransactionVerificationException, IOException {
    Transaction tx = getLockupTx(lockupAmount, lockTime, lockupReason, hash);
    Coin miningFee = tx.getFee();
    int txSize = tx.bitcoinSerialize().length;
    return new Tuple2<>(miningFee, txSize);
}
 
Example 4
Source File: MyBlindVoteListService.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public Tuple2<Coin, Integer> getMiningFeeAndTxSize(Coin stake)
        throws InsufficientMoneyException, WalletException, TransactionVerificationException {
    // We set dummy opReturn data
    Coin blindVoteFee = BlindVoteConsensus.getFee(daoStateService, daoStateService.getChainHeight());
    Transaction dummyTx = getBlindVoteTx(stake, blindVoteFee, new byte[22]);
    Coin miningFee = dummyTx.getFee();
    int txSize = dummyTx.bitcoinSerialize().length;
    return new Tuple2<>(miningFee, txSize);
}
 
Example 5
Source File: BtcWalletService.java    From bisq-core with GNU Affero General Public License v3.0 4 votes vote down vote up
private boolean feeEstimationNotSatisfied(int counter, Transaction tx) {
    long targetFee = getTxFeeForWithdrawalPerByte().multiply(tx.bitcoinSerialize().length).value;
    return counter < 10 &&
            (tx.getFee().value < targetFee ||
                    tx.getFee().value - targetFee > 1000);
}
 
Example 6
Source File: BtcWalletService.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private boolean feeEstimationNotSatisfied(int counter, Transaction tx) {
    long targetFee = getTxFeeForWithdrawalPerByte().multiply(tx.bitcoinSerialize().length).value;
    return counter < 10 &&
            (tx.getFee().value < targetFee ||
                    tx.getFee().value - targetFee > 1000);
}