Skip to content

Commit

Permalink
WalletTest: fix spurious test failure of `witnessTransactionGetFeeTes…
Browse files Browse the repository at this point in the history
…t()`

This was caused by a shorter than expected signature encoding, which
can happen in rare cases.

This is a backport of fb2dad4.
  • Loading branch information
schildbach committed Jun 24, 2024
1 parent 17d63d8 commit 12af8b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/test/java/org/bitcoinj/wallet/WalletTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2702,7 +2702,9 @@ public void witnessTransactionGetFeeTest() throws Exception {
int vsize = request.tx.getVsize();
Coin feePerVkb = fee.multiply(1000).divide(vsize);
assertEquals(Coin.valueOf(14100), fee);
assertEquals(Transaction.DEFAULT_TX_FEE, feePerVkb);
// due to shorter than expected signature encoding, in rare cases we overpay a little
Coin overpaidFee = Transaction.DEFAULT_TX_FEE.add(valueOf(714));
assertTrue(feePerVkb.toString(),feePerVkb.equals(Transaction.DEFAULT_TX_FEE) || feePerVkb.equals(overpaidFee));
}

@Test
Expand Down

0 comments on commit 12af8b9

Please sign in to comment.