Skip to content

Commit

Permalink
Change Flipstarter cancel UTXO handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pokkst committed Feb 14, 2021
1 parent 974010d commit d574ff1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/src/main/java/org/bitcoinj/wallet/SendRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,13 @@ public static Pair<Transaction, String> createFlipstarterPledge(Wallet wallet, S
public static SendRequest cancelFlipstarterPledge(Wallet wallet, TransactionOutput pledgeUtxo) throws InsufficientMoneyException {
SendRequest req = new SendRequest();
req.tx = new Transaction(wallet.getParams());
req.tx.addInput(pledgeUtxo);
Coin newUtxoAmount = Coin.valueOf(pledgeUtxo.getValue().value - 225L); //- 225 sats to ensure over 1 sat/byte, because bitcoincashj can get fucky with exactly 1 sat/byte
req.tx.addOutput(newUtxoAmount, wallet.freshReceiveAddress());
ArrayList<TransactionOutput> pledgeUtxos = new ArrayList<>();
pledgeUtxos.add(pledgeUtxo);
req.utxos = pledgeUtxos;
req.emptyWallet = true;
req.feePerKb = Coin.valueOf(1000L);
req.ensureMinRequiredFee = true;
req.tx.addOutput(Coin.ZERO, wallet.freshReceiveAddress());
return req;
}

Expand Down

0 comments on commit d574ff1

Please sign in to comment.