-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7393 from alvasw/Handle_burning_man_selection_hei…
…ght_edge-cases Handle burning man selection height edge cases
- Loading branch information
Showing
4 changed files
with
77 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
.../core/trade/protocol/bisq_v1/tasks/maker/MakerProcessesInputsForDepositTxRequestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package bisq.core.trade.protocol.bisq_v1.tasks.maker; | ||
|
||
import bisq.core.dao.burningman.DelayedPayoutTxReceiverService; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class MakerProcessesInputsForDepositTxRequestTest { | ||
private static final int GENESIS_HEIGHT = 102; | ||
private static final int GRID_SIZE = DelayedPayoutTxReceiverService.SNAPSHOT_SELECTION_GRID_SIZE; | ||
|
||
@Test | ||
void burningManSelectionHeightSameBlock() { | ||
assertEquals(130, | ||
DelayedPayoutTxReceiverService.getSnapshotHeight(GENESIS_HEIGHT, 139, GRID_SIZE, 0)); | ||
boolean isValid = MakerProcessesInputsForDepositTxRequest | ||
.verifyBurningManSelectionHeight(130, 130); | ||
assertTrue(isValid); | ||
} | ||
|
||
@Test | ||
void burningManSelectionHeightMakerOneBlockInFuture() { | ||
assertEquals(120, | ||
DelayedPayoutTxReceiverService.getSnapshotHeight(GENESIS_HEIGHT, 134, GRID_SIZE, 0)); | ||
assertEquals(130, | ||
DelayedPayoutTxReceiverService.getSnapshotHeight(GENESIS_HEIGHT, 135, GRID_SIZE, 0)); | ||
boolean isValid = MakerProcessesInputsForDepositTxRequest | ||
.verifyBurningManSelectionHeight(120, 130); | ||
assertTrue(isValid); | ||
} | ||
|
||
@Test | ||
void burningManSelectionHeightTakerOneBlockInFuture() { | ||
assertEquals(120, | ||
DelayedPayoutTxReceiverService.getSnapshotHeight(GENESIS_HEIGHT, 134, GRID_SIZE, 0)); | ||
assertEquals(130, | ||
DelayedPayoutTxReceiverService.getSnapshotHeight(GENESIS_HEIGHT, 135, GRID_SIZE, 0)); | ||
boolean isValid = MakerProcessesInputsForDepositTxRequest | ||
.verifyBurningManSelectionHeight(130, 120); | ||
assertTrue(isValid); | ||
} | ||
} |