use of co.rsk.core.Coin in project rskj by rsksmart.
the class MinerUtilsTest method validTransactionAccWrapNonceTest.
@Test
public void validTransactionAccWrapNonceTest() {
Transaction tx = Tx.create(config, 0, 50000, 5, 1, 0, 0);
// Mockito.when(tx.checkGasPrice(Mockito.any(BigInteger.class))).thenReturn(true);
List<Transaction> txs = new LinkedList<>();
txs.add(tx);
Map<RskAddress, BigInteger> accountNounces = new HashMap();
accountNounces.put(tx.getSender(), BigInteger.valueOf(0));
Repository repository = Mockito.mock(Repository.class);
Coin minGasPrice = Coin.valueOf(1L);
List<Transaction> res = new MinerUtils().filterTransactions(new LinkedList<>(), txs, accountNounces, repository, minGasPrice);
Assert.assertEquals(1, res.size());
}
use of co.rsk.core.Coin in project rskj by rsksmart.
the class MinimumGasPriceCalculatorTest method mgpOnRage.
@Test
public void mgpOnRage() {
MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator();
Coin prev = Coin.valueOf(1000L);
Coin target = Coin.valueOf(995L);
Coin mgp = mgpCalculator.calculate(prev, target);
Assert.assertEquals(target, mgp);
}
use of co.rsk.core.Coin in project rskj by rsksmart.
the class MinimumGasPriceCalculatorTest method increaseMgp.
@Test
public void increaseMgp() {
MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator();
Coin prev = Coin.valueOf(1000L);
Coin target = Coin.valueOf(2000L);
Coin mgp = mgpCalculator.calculate(prev, target);
Assert.assertEquals(Coin.valueOf(1010), mgp);
}
use of co.rsk.core.Coin in project rskj by rsksmart.
the class MinimumGasPriceCalculatorTest method decreaseMGP.
@Test
public void decreaseMGP() {
MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator();
Coin prev = Coin.valueOf(1000L);
Coin target = Coin.valueOf(900L);
Coin mgp = mgpCalculator.calculate(prev, target);
Assert.assertEquals(Coin.valueOf(990), mgp);
}
use of co.rsk.core.Coin in project rskj by rsksmart.
the class MinimumGasPriceCalculatorTest method previousMgpEqualsTarget.
@Test
public void previousMgpEqualsTarget() {
MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator();
Coin prev = Coin.valueOf(1000L);
Coin target = Coin.valueOf(1000L);
Coin mgp = mgpCalculator.calculate(prev, target);
Assert.assertEquals(target, mgp);
}
Aggregations