target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void getBlock_latest() { Block bestBlock = mock(Block.class); when(blockchain.getBestBlock()).thenReturn(bestBlock); Optional<Block> result = target.getBlock("latest"); assertTrue(result.isPresent()); assertEquals(bestBlock, result.get()); }
public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { block = blockchain.getBlockByNu...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
@Test public void getBlock_earliest() { Block earliestBlock = mock(Block.class); when(blockchain.getBlockByNumber(0)).thenReturn(earliestBlock); Optional<Block> result = target.getBlock("earliest"); assertTrue(result.isPresent()); assertEquals(earliestBlock, result.get()); }
public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { block = blockchain.getBlockByNu...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
@Test public void getBlock_number() { Block secondBlock = mock(Block.class); when(blockchain.getBlockByNumber(2)).thenReturn(secondBlock); Optional<Block> result = target.getBlock("0x2"); assertTrue(result.isPresent()); assertEquals(secondBlock, result.get()); }
public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { block = blockchain.getBlockByNu...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
@Test public void createNewAccount() { Web3Impl web3 = createWeb3(); String addr = web3.personal_newAccount("passphrase1"); Account account = null; try { account = wallet.getAccount(new RskAddress(addr), "passphrase1"); } catch (Exception e) { e.printStackTrace(); return; } assertNotNull(account); org.junit.Assert.asse...
@Override public String personal_newAccount(String passphrase) { return personalModule.newAccount(passphrase); }
Web3Impl implements Web3 { @Override public String personal_newAccount(String passphrase) { return personalModule.newAccount(passphrase); } }
Web3Impl implements Web3 { @Override public String personal_newAccount(String passphrase) { return personalModule.newAccount(passphrase); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSystemPro...
Web3Impl implements Web3 { @Override public String personal_newAccount(String passphrase) { return personalModule.newAccount(passphrase); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSystemPro...
Web3Impl implements Web3 { @Override public String personal_newAccount(String passphrase) { return personalModule.newAccount(passphrase); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSystemPro...
@Test public void getBlock_notFound() { Optional<Block> result = target.getBlock("0x2"); assertFalse(result.isPresent()); }
public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { block = blockchain.getBlockByNu...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
Web3InformationRetriever { public Optional<Block> getBlock(String identifier) { if (PENDING.equals(identifier)) { throw unimplemented("This method doesn't support 'pending' as a parameter"); } Block block; if (LATEST.equals(identifier)) { block = blockchain.getBestBlock(); } else if (EARLIEST.equals(identifier)) { bloc...
@Test public void getTransactions_pending() { List<Transaction> txs = new LinkedList<>(); txs.add(mock(Transaction.class)); txs.add(mock(Transaction.class)); when(txPool.getPendingTransactions()).thenReturn(txs); List<Transaction> result = target.getTransactions("pending"); assertEquals(txs, result); }
public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %s not found", identifier)))...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
@Test public void getTransactions_earliest() { List<Transaction> txs = new LinkedList<>(); txs.add(mock(Transaction.class)); txs.add(mock(Transaction.class)); Block block = mock(Block.class); when(block.getTransactionsList()).thenReturn(txs); when(blockchain.getBlockByNumber(0)).thenReturn(block); List<Transaction> res...
public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %s not found", identifier)))...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
@Test public void getTransactions_latest() { List<Transaction> txs = new LinkedList<>(); txs.add(mock(Transaction.class)); txs.add(mock(Transaction.class)); Block block = mock(Block.class); when(block.getTransactionsList()).thenReturn(txs); when(blockchain.getBestBlock()).thenReturn(block); List<Transaction> result = t...
public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %s not found", identifier)))...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
@Test public void getTransactions_number() { List<Transaction> txs = new LinkedList<>(); txs.add(mock(Transaction.class)); txs.add(mock(Transaction.class)); Block block = mock(Block.class); when(block.getTransactionsList()).thenReturn(txs); when(blockchain.getBlockByNumber(3)).thenReturn(block); List<Transaction> resul...
public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %s not found", identifier)))...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
@Test public void getTransactions_blockNotFound() { RskJsonRpcRequestException e = TestUtils .assertThrows(RskJsonRpcRequestException.class, () -> target.getTransactions("0x3")); assertEquals(-32600, (int) e.getCode()); }
public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %s not found", identifier)))...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
Web3InformationRetriever { public List<Transaction> getTransactions(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingTransactions(); } Optional<Block> block = getBlock(identifier); return block.map(Block::getTransactionsList) .orElseThrow(() -> blockNotFound(String.format("Block %...
@Test public void getState_pending() { PendingState aip = mock(PendingState.class); when(txPool.getPendingState()).thenReturn(aip); AccountInformationProvider result = target.getInformationProvider("pending"); assertEquals(aip, result); }
public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", identifier)); } Block block = ...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
@Test public void getState_earliest() { Block block = mock(Block.class); BlockHeader header = mock(BlockHeader.class); when(block.getHeader()).thenReturn(header); when(blockchain.getBlockByNumber(0)).thenReturn(block); RepositorySnapshot snapshot = mock(RepositorySnapshot.class); when(locator.findSnapshotAt(eq(header))...
public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", identifier)); } Block block = ...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
@Test public void getState_latest() { Block block = mock(Block.class); BlockHeader header = mock(BlockHeader.class); when(block.getHeader()).thenReturn(header); when(blockchain.getBestBlock()).thenReturn(block); RepositorySnapshot snapshot = mock(RepositorySnapshot.class); when(locator.findSnapshotAt(eq(header))).thenR...
public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", identifier)); } Block block = ...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
@Test public void getState_number() { Block block = mock(Block.class); BlockHeader header = mock(BlockHeader.class); when(block.getHeader()).thenReturn(header); when(blockchain.getBlockByNumber(4)).thenReturn(block); RepositorySnapshot snapshot = mock(RepositorySnapshot.class); when(locator.findSnapshotAt(eq(header)))....
public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", identifier)); } Block block = ...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
@Test public void importAccountUsingRawKey() { Web3Impl web3 = createWeb3(); ECKey eckey = new ECKey(); byte[] privKeyBytes = eckey.getPrivKeyBytes(); ECKey privKey = ECKey.fromPrivate(privKeyBytes); RskAddress addr = new RskAddress(privKey.getAddress()); Account account = wallet.getAccount(addr); org.junit.Assert.asse...
@Override public String personal_importRawKey(String key, String passphrase) { return personalModule.importRawKey(key, passphrase); }
Web3Impl implements Web3 { @Override public String personal_importRawKey(String key, String passphrase) { return personalModule.importRawKey(key, passphrase); } }
Web3Impl implements Web3 { @Override public String personal_importRawKey(String key, String passphrase) { return personalModule.importRawKey(key, passphrase); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, ...
Web3Impl implements Web3 { @Override public String personal_importRawKey(String key, String passphrase) { return personalModule.importRawKey(key, passphrase); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, ...
Web3Impl implements Web3 { @Override public String personal_importRawKey(String key, String passphrase) { return personalModule.importRawKey(key, passphrase); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, ...
@Test public void getState_blockNotFound() { RskJsonRpcRequestException e = TestUtils .assertThrows(RskJsonRpcRequestException.class, () -> target.getInformationProvider("0x4")); assertEquals("Block 0x4 not found", e.getMessage()); }
public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", identifier)); } Block block = ...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
@Test public void getTransactions_stateNotFound() { Block block = mock(Block.class); BlockHeader header = mock(BlockHeader.class); when(block.getHeader()).thenReturn(header); Keccak256 blockHash = new Keccak256(new byte[32]); when(block.getHash()).thenReturn(blockHash); when(blockchain.getBlockByNumber(4)).thenReturn(b...
public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", identifier)); } Block block = ...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
Web3InformationRetriever { public AccountInformationProvider getInformationProvider(String identifier) { if (PENDING.equals(identifier)) { return transactionPool.getPendingState(); } Optional<Block> optBlock = getBlock(identifier); if (!optBlock.isPresent()) { throw blockNotFound(String.format("Block %s not found", ide...
@Test public void checkModuleNames() throws Throwable { RequestInterceptor jsonRpcMethodFilter = new JsonRpcMethodFilter(getModules()); jsonRpcMethodFilter.interceptRequest(getMethodInvocation("evm_snapshot")); jsonRpcMethodFilter.interceptRequest(getMethodInvocation("evm_revert")); try { jsonRpcMethodFilter.interceptR...
@Override public void interceptRequest(JsonNode node) throws IOException { if (node.hasNonNull(JsonRpcBasicServer.METHOD)) { checkMethod(node.get(JsonRpcBasicServer.METHOD).asText()); } }
JsonRpcMethodFilter implements RequestInterceptor { @Override public void interceptRequest(JsonNode node) throws IOException { if (node.hasNonNull(JsonRpcBasicServer.METHOD)) { checkMethod(node.get(JsonRpcBasicServer.METHOD).asText()); } } }
JsonRpcMethodFilter implements RequestInterceptor { @Override public void interceptRequest(JsonNode node) throws IOException { if (node.hasNonNull(JsonRpcBasicServer.METHOD)) { checkMethod(node.get(JsonRpcBasicServer.METHOD).asText()); } } JsonRpcMethodFilter(List<ModuleDescription> modules); }
JsonRpcMethodFilter implements RequestInterceptor { @Override public void interceptRequest(JsonNode node) throws IOException { if (node.hasNonNull(JsonRpcBasicServer.METHOD)) { checkMethod(node.get(JsonRpcBasicServer.METHOD).asText()); } } JsonRpcMethodFilter(List<ModuleDescription> modules); @Override void interceptRe...
JsonRpcMethodFilter implements RequestInterceptor { @Override public void interceptRequest(JsonNode node) throws IOException { if (node.hasNonNull(JsonRpcBasicServer.METHOD)) { checkMethod(node.get(JsonRpcBasicServer.METHOD).asText()); } } JsonRpcMethodFilter(List<ModuleDescription> modules); @Override void interceptRe...
@Test public void invalidRefererWithDifferentProtocol() throws URISyntaxException { OriginValidator validator = new OriginValidator("http: Assert.assertFalse(validator.isValidReferer("https: }
public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } String refererHost ...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
@Test public void invalidRefererWithDifferentHost() throws URISyntaxException { OriginValidator validator = new OriginValidator("http: Assert.assertFalse(validator.isValidReferer("http: }
public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } String refererHost ...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
@Test public void invalidRefererWithDifferentPort() throws URISyntaxException { OriginValidator validator = new OriginValidator("http: Assert.assertFalse(validator.isValidReferer("http: }
public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } String refererHost ...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
OriginValidator { public boolean isValidReferer(String referer) { if (this.allowAllOrigins) { return true; } URL refererUrl = null; try { refererUrl = new URL(referer); } catch (MalformedURLException e) { return false; } String refererProtocol = refererUrl.getProtocol(); if (refererProtocol == null) { return false; } S...
@Test public void methodIsInModule() { ModuleDescription description = new ModuleDescription("evm", "1.0", true, null, null); Assert.assertTrue(description.methodIsInModule("evm_snapshot")); Assert.assertTrue(description.methodIsInModule("evm_do")); Assert.assertFalse(description.methodIsInModule("eth_getBlock")); Asse...
public boolean methodIsInModule(String methodName) { if (methodName == null) { return false; } if (!methodName.startsWith(this.name)) { return false; } if (methodName.length() == this.name.length()) { return false; } if (methodName.charAt(this.name.length()) != '_') { return false; } return true; }
ModuleDescription { public boolean methodIsInModule(String methodName) { if (methodName == null) { return false; } if (!methodName.startsWith(this.name)) { return false; } if (methodName.length() == this.name.length()) { return false; } if (methodName.charAt(this.name.length()) != '_') { return false; } return true; } ...
ModuleDescription { public boolean methodIsInModule(String methodName) { if (methodName == null) { return false; } if (!methodName.startsWith(this.name)) { return false; } if (methodName.length() == this.name.length()) { return false; } if (methodName.charAt(this.name.length()) != '_') { return false; } return true; } ...
ModuleDescription { public boolean methodIsInModule(String methodName) { if (methodName == null) { return false; } if (!methodName.startsWith(this.name)) { return false; } if (methodName.length() == this.name.length()) { return false; } if (methodName.charAt(this.name.length()) != '_') { return false; } return true; } ...
ModuleDescription { public boolean methodIsInModule(String methodName) { if (methodName == null) { return false; } if (!methodName.startsWith(this.name)) { return false; } if (methodName.length() == this.name.length()) { return false; } if (methodName.charAt(this.name.length()) != '_') { return false; } return true; } ...
@Test public void methodIsEnabledWhenEmptyNameList() { ModuleDescription description = new ModuleDescription("evm", "1.0", true, null, null); Assert.assertTrue(description.methodIsEnable("evm_snapshot")); Assert.assertTrue(description.methodIsEnable("evm_do")); Assert.assertFalse(description.methodIsEnable("eth_getBloc...
public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; } if (this.enabledMet...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
@Test public void methodIsEnabledWhenEnabledNameList() { List<String> enabledMethods = new ArrayList<>(); enabledMethods.add("evm_snapshot"); enabledMethods.add("evm_revert"); ModuleDescription description = new ModuleDescription("evm", "1.0", true, enabledMethods, null); Assert.assertTrue(description.methodIsEnable("e...
public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; } if (this.enabledMet...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
@Test public void methodIsEnabledWhenDisabledNameList() { List<String> disabledMethods = new ArrayList<>(); disabledMethods.add("evm_reset"); disabledMethods.add("evm_increaseTime"); ModuleDescription description = new ModuleDescription("evm", "1.0", true, null, disabledMethods); Assert.assertTrue(description.methodIsE...
public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; } if (this.enabledMet...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
@Test public void eth_sendTransaction() { BigInteger nonce = BigInteger.ONE; ReceiptStore receiptStore = new ReceiptStoreImpl(new HashMapDB()); World world = new World(receiptStore); BlockChainImpl blockChain = world.getBlockChain(); BlockStore blockStore = world.getBlockStore(); TransactionExecutorFactory transactionE...
@Override public String[] personal_listAccounts() { return personalModule.listAccounts(); }
Web3Impl implements Web3 { @Override public String[] personal_listAccounts() { return personalModule.listAccounts(); } }
Web3Impl implements Web3 { @Override public String[] personal_listAccounts() { return personalModule.listAccounts(); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSystemProperties config, ...
Web3Impl implements Web3 { @Override public String[] personal_listAccounts() { return personalModule.listAccounts(); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSystemProperties config, ...
Web3Impl implements Web3 { @Override public String[] personal_listAccounts() { return personalModule.listAccounts(); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSystemProperties config, ...
@Test public void methodIsEnabledWhenEnabledAndDisabledNameLists() { List<String> enabledMethods = new ArrayList<>(); enabledMethods.add("evm_snapshot"); enabledMethods.add("evm_revert"); enabledMethods.add("evm_reset"); List<String> disabledMethods = new ArrayList<>(); disabledMethods.add("evm_reset"); disabledMethods...
public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; } if (this.enabledMet...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
ModuleDescription { public boolean methodIsEnable(String methodName) { if (!this.isEnabled()) { return false; } if (!this.methodIsInModule(methodName)) { return false; } if (this.disabledMethods.contains(methodName)) { return false; } if (this.enabledMethods.isEmpty() && this.disabledMethods.isEmpty()) { return true; }...
@Test public void testEncryptedData() { EncryptedData ed = new EncryptedData(new byte[]{1,2,3}, new byte[]{4,5,6}); EncryptedData ed2 = new EncryptedData(new byte[]{1,2,3}, new byte[]{4,5,6}); EncryptedData ed3 = new EncryptedData(new byte[]{1,2,3}, new byte[]{4,5,7}); Assert.assertEquals(ed.toString(), ed2.toString())...
public EncryptedData(byte[] initialisationVector, byte[] encryptedBytes) { this.initialisationVector = Arrays.copyOf(initialisationVector, initialisationVector.length); this.encryptedBytes = Arrays.copyOf(encryptedBytes, encryptedBytes.length); }
EncryptedData { public EncryptedData(byte[] initialisationVector, byte[] encryptedBytes) { this.initialisationVector = Arrays.copyOf(initialisationVector, initialisationVector.length); this.encryptedBytes = Arrays.copyOf(encryptedBytes, encryptedBytes.length); } }
EncryptedData { public EncryptedData(byte[] initialisationVector, byte[] encryptedBytes) { this.initialisationVector = Arrays.copyOf(initialisationVector, initialisationVector.length); this.encryptedBytes = Arrays.copyOf(encryptedBytes, encryptedBytes.length); } EncryptedData(byte[] initialisationVector, byte[] encrypt...
EncryptedData { public EncryptedData(byte[] initialisationVector, byte[] encryptedBytes) { this.initialisationVector = Arrays.copyOf(initialisationVector, initialisationVector.length); this.encryptedBytes = Arrays.copyOf(encryptedBytes, encryptedBytes.length); } EncryptedData(byte[] initialisationVector, byte[] encrypt...
EncryptedData { public EncryptedData(byte[] initialisationVector, byte[] encryptedBytes) { this.initialisationVector = Arrays.copyOf(initialisationVector, initialisationVector.length); this.encryptedBytes = Arrays.copyOf(encryptedBytes, encryptedBytes.length); } EncryptedData(byte[] initialisationVector, byte[] encrypt...
@Test public void refreshWorkRunOnce() { Assert.assertEquals(0, blockchain.getBestBlock().getNumber()); MinerServerImpl minerServer = getMinerServer(); MinerClientImpl minerClient = getMinerClient(minerServer); MinerClientImpl.RefreshWork refreshWork = minerClient.createRefreshWork(); Assert.assertNotNull(refreshWork);...
public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } void mineBlock(MinerClient minerClient, MinerServer minerServer); }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } void mineBlock(MinerClient minerClient, MinerServer minerServer); }
@Test public void refreshWorkRunTwice() { Assert.assertEquals(0, blockchain.getBestBlock().getNumber()); MinerServerImpl minerServer = getMinerServer(); MinerClientImpl minerClient = getMinerClient(minerServer); MinerClientImpl.RefreshWork refreshWork = minerClient.createRefreshWork(); Assert.assertNotNull(refreshWork)...
public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } void mineBlock(MinerClient minerClient, MinerServer minerServer); }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } void mineBlock(MinerClient minerClient, MinerServer minerServer); }
@Test public void mineBlockTwiceReusingTheSameWork() { Assert.assertEquals(0, blockchain.getBestBlock().getNumber()); MinerServerImpl minerServer = getMinerServer(); MinerClientImpl minerClient = getMinerClient(minerServer); minerServer.buildBlockToMine( false); MinerWork minerWork = minerServer.getWork(); Assert.asser...
public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } void mineBlock(MinerClient minerClient, MinerServer minerServer); }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } void mineBlock(MinerClient minerClient, MinerServer minerServer); }
@Test public void mineBlockWhileSyncingBlocks() { Assert.assertEquals(0, blockchain.getBestBlock().getNumber()); NodeBlockProcessor nodeBlockProcessor = mock(NodeBlockProcessor.class); when(nodeBlockProcessor.hasBetterBlockToSync()).thenReturn(true); MinerServerImpl minerServer = getMinerServer(); MinerClientImpl miner...
public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } void mineBlock(MinerClient minerClient, MinerServer minerServer); }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } void mineBlock(MinerClient minerClient, MinerServer minerServer); }
@Test public void mineBlock() { Assert.assertEquals(0, blockchain.getBestBlock().getNumber()); MinerManager manager = new MinerManager(); MinerServerImpl minerServer = getMinerServer(); MinerClientImpl minerClient = getMinerClient(minerServer); manager.mineBlock(minerClient, minerServer); Assert.assertEquals(1, blockch...
public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } void mineBlock(MinerClient minerClient, MinerServer minerServer); }
MinerManager { public void mineBlock(MinerClient minerClient, MinerServer minerServer) { minerServer.buildBlockToMine(false); minerClient.mineBlock(); } void mineBlock(MinerClient minerClient, MinerServer minerServer); }
@Test public void getAllTransactionsTest() { TransactionPool transactionPool = Mockito.mock(TransactionPool.class); Transaction tx1 = Mockito.mock(Transaction.class); Transaction tx2 = Mockito.mock(Transaction.class); byte[] s1 = new byte[32]; byte[] s2 = new byte[32]; s1[0] = 0; s2[0] = 1; byte[] addressBytes = ByteUt...
public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { List<Transaction> txs = transactionPool.getPendingTransactions(); return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); }
MinerUtils { public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { List<Transaction> txs = transactionPool.getPendingTransactions(); return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); } }
MinerUtils { public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { List<Transaction> txs = transactionPool.getPendingTransactions(); return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); } }
MinerUtils { public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { List<Transaction> txs = transactionPool.getPendingTransactions(); return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); } static co.rsk.bitcoinj.core.BtcTransaction getBitcoinMergedMiningCoinbas...
MinerUtils { public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { List<Transaction> txs = transactionPool.getPendingTransactions(); return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); } static co.rsk.bitcoinj.core.BtcTransaction getBitcoinMergedMiningCoinbas...
@Test public void validTransactionRepositoryNonceTest() { Transaction tx = Tx.create(config, 0, 50000, 5, 0, 0, 0); List<Transaction> txs = new LinkedList<>(); txs.add(tx); Map<RskAddress, BigInteger> accountNounces = new HashMap(); Repository repository = Mockito.mock(Repository.class); Mockito.when(repository.getNonc...
public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Transaction tx : t...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
@Test public void validTransactionAccWrapNonceTest() { Transaction tx = Tx.create(config, 0, 50000, 5, 1, 0, 0); List<Transaction> txs = new LinkedList<>(); txs.add(tx); Map<RskAddress, BigInteger> accountNounces = new HashMap(); accountNounces.put(tx.getSender(), BigInteger.valueOf(0)); Repository repository = Mockito...
public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Transaction tx : t...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
@Test public void createNewAccountWithoutDuplicates(){ Web3Impl web3 = createWeb3(); int originalAccountSize = wallet.getAccountAddresses().size(); String testAccountAddress = web3.personal_newAccountWithSeed("testAccount"); assertEquals("The number of accounts was not increased", originalAccountSize + 1, wallet.getAcc...
@Override public String personal_newAccountWithSeed(String seed) { return personalModule.newAccountWithSeed(seed); }
Web3Impl implements Web3 { @Override public String personal_newAccountWithSeed(String seed) { return personalModule.newAccountWithSeed(seed); } }
Web3Impl implements Web3 { @Override public String personal_newAccountWithSeed(String seed) { return personalModule.newAccountWithSeed(seed); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSyste...
Web3Impl implements Web3 { @Override public String personal_newAccountWithSeed(String seed) { return personalModule.newAccountWithSeed(seed); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSyste...
Web3Impl implements Web3 { @Override public String personal_newAccountWithSeed(String seed) { return personalModule.newAccountWithSeed(seed); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSyste...
@Test public void invalidNonceTransactionTest() { Transaction tx = Tx.create(config, 0, 50000, 2, 0, 0, 0); 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...
public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Transaction tx : t...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
@Test public void invalidGasPriceTransactionTest() { Transaction tx = Tx.create(config, 0, 50000, 1, 0, 0, 0); List<Transaction> txs = new LinkedList<>(); txs.add(tx); Map<RskAddress, BigInteger> accountNounces = new HashMap(); byte[] addressBytes = ByteUtil.leftPadBytes(BigInteger.valueOf(new Random(0).nextLong()).toB...
public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Transaction tx : t...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
@Test public void harmfulTransactionTest() { Transaction tx = Tx.create(config, 0, 50000, 1, 0, 0, 0); List<Transaction> txs = new LinkedList<>(); txs.add(tx); Mockito.when(tx.getGasPrice()).thenReturn(null); Map<RskAddress, BigInteger> accountNounces = new HashMap(); byte[] addressBytes = ByteUtil.leftPadBytes(BigInte...
public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Transaction tx : t...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
MinerUtils { public List<org.ethereum.core.Transaction> filterTransactions(List<Transaction> txsToRemove, List<Transaction> txs, Map<RskAddress, BigInteger> accountNonces, RepositorySnapshot originalRepo, Coin minGasPrice) { List<org.ethereum.core.Transaction> txsResult = new ArrayList<>(); for (org.ethereum.core.Trans...
@Test public void getAllTransactionsCheckOrderTest() { TransactionPool transactionPool = Mockito.mock(TransactionPool.class); Transaction tx0 = Mockito.mock(Transaction.class); Transaction tx1 = Mockito.mock(Transaction.class); Transaction tx2 = Mockito.mock(Transaction.class); Transaction tx3 = Mockito.mock(Transactio...
public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { List<Transaction> txs = transactionPool.getPendingTransactions(); return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); }
MinerUtils { public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { List<Transaction> txs = transactionPool.getPendingTransactions(); return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); } }
MinerUtils { public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { List<Transaction> txs = transactionPool.getPendingTransactions(); return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); } }
MinerUtils { public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { List<Transaction> txs = transactionPool.getPendingTransactions(); return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); } static co.rsk.bitcoinj.core.BtcTransaction getBitcoinMergedMiningCoinbas...
MinerUtils { public List<org.ethereum.core.Transaction> getAllTransactions(TransactionPool transactionPool) { List<Transaction> txs = transactionPool.getPendingTransactions(); return PendingState.sortByPriceTakingIntoAccountSenderAndNonce(txs); } static co.rsk.bitcoinj.core.BtcTransaction getBitcoinMergedMiningCoinbas...
@Test public void BuildBlockHasEmptyUnclesWhenCreateAnInvalidBlock() { BlockHeader parent = buildBlockHeaderWithSibling(); BlockResult expectedResult = mock(BlockResult.class); ArgumentCaptor<Block> blockCaptor = ArgumentCaptor.forClass(Block.class); when(validationRules.isValid(any())).thenReturn(false); when(blockExe...
public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUncleGenerationLimit() )...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
@Test public void BuildBlockHasUnclesWhenCreateAnInvalidBlock() { BlockHeader parent = buildBlockHeaderWithSibling(); BlockResult expectedResult = mock(BlockResult.class); ArgumentCaptor<Block> blockCaptor = ArgumentCaptor.forClass(Block.class); when(validationRules.isValid(any())).thenReturn(true); when(blockExecutor....
public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUncleGenerationLimit() )...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
@Test public void buildBlockBeforeUMMActivation() { Keccak256 parentHash = TestUtils.randomHash(); BlockHeader parent = mock(BlockHeader.class); when(parent.getNumber()).thenReturn(500L); when(parent.getHash()).thenReturn(parentHash); when(parent.getGasLimit()).thenReturn(new byte[0]); when(parent.getMinimumGasPrice())...
public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUncleGenerationLimit() )...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
@Test public void buildBlockAfterUMMActivation() { Keccak256 parentHash = TestUtils.randomHash(); BlockHeader parent = mock(BlockHeader.class); when(parent.getNumber()).thenReturn(500L); when(parent.getHash()).thenReturn(parentHash); when(parent.getGasLimit()).thenReturn(new byte[0]); when(parent.getMinimumGasPrice())....
public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUncleGenerationLimit() )...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
BlockToMineBuilder { public BlockResult build(List<BlockHeader> mainchainHeaders, byte[] extraData) { BlockHeader newBlockParentHeader = mainchainHeaders.get(0); List<BlockHeader> uncles = FamilyUtils.getUnclesHeaders( blockStore, newBlockParentHeader.getNumber() + 1, newBlockParentHeader.getHash(), miningConfig.getUnc...
@Test public void byDefaultIsDisabled() { assertThat(autoMinerClient.isMining(), is(false)); }
@Override public boolean isMining() { return this.isMining; }
AutoMinerClient implements MinerClient { @Override public boolean isMining() { return this.isMining; } }
AutoMinerClient implements MinerClient { @Override public boolean isMining() { return this.isMining; } AutoMinerClient(MinerServer minerServer); }
AutoMinerClient implements MinerClient { @Override public boolean isMining() { return this.isMining; } AutoMinerClient(MinerServer minerServer); @Override void start(); @Override boolean isMining(); @Override boolean mineBlock(); @Override void stop(); }
AutoMinerClient implements MinerClient { @Override public boolean isMining() { return this.isMining; } AutoMinerClient(MinerServer minerServer); @Override void start(); @Override boolean isMining(); @Override boolean mineBlock(); @Override void stop(); }
@Test public void NextBlockGasLimitIsDecreasedByAFactor() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger minGasLimit = BigInteger.valueOf(constants.getMinGasLimit()); BigInteger parentGasLimit = minGasLimit.add(BigInteger.valueOf(21000)); BigInteger targetGasLimit = BigInte...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void noEventsAfterEmptyBlock() { LogFilter filter = new LogFilter(null, null, false, false); Block block = new BlockGenerator().getBlock(1); filter.newBlockReceived(block); Object[] result = filter.getEvents(); Assert.assertNotNull(result); Assert.assertEquals(0, result.length); }
@Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); @Overri...
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); @Overri...
@Test public void NextBlockGasLimitIsNotDecreasedLowerThanMinGasLimit() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger minGasLimit = BigInteger.valueOf(constants.getMinGasLimit()); BigInteger targetGasLimit = BigInteger.valueOf(config.getTargetGasLimit()); BigInteger newGas...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void NextBlockGasLimitIsIncreasedBasedOnGasUsed() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger parentGas = BigInteger.valueOf(3500000); BigInteger gasUsed = BigInteger.valueOf(3000000); BigInteger targetGasLimit = BigInteger.valueOf(config.getTargetGasLimit()...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void NextBlockGasLimitIsIncreasedBasedOnFullGasUsed() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger parentGas = BigInteger.valueOf(3500000); BigInteger gasUsed = BigInteger.valueOf(3500000); BigInteger targetGasLimit = BigInteger.valueOf(config.getTargetGasLim...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void NextBlockGasLimitIsNotIncreasedMoreThanTargetGasLimit() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger targetGasLimit = BigInteger.valueOf(config.getTargetGasLimit()); BigInteger gasUsed = targetGasLimit; BigInteger newGasLimit = calc.calculateBlockGasLimi...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void NextBlockGasLimitRemainsTheSame() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger minGasLimit = BigInteger.valueOf(config.getTargetGasLimit()); BigInteger targetGasLimit = BigInteger.valueOf(config.getTargetGasLimit()); BigInteger newGasLimit = calc.calcula...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void NextBlockGasLimitIsIncreasedByMaximumValue() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger minGasLimit = BigInteger.valueOf(constants.getMinGasLimit()); BigInteger targetGasLimit = BigInteger.valueOf(config.getTargetGasLimit()); BigInteger newGasLimit = c...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void NextBlockGasLimitIsIncreasedToTarget() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger minGasLimit = BigInteger.valueOf(constants.getMinGasLimit()); BigInteger targetGasLimit = minGasLimit.add(BigInteger.ONE); BigInteger newGasLimit = calc.calculateBlockGas...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void NextBlockGasLimitIsDecreasedToTarget() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger minGasLimit = BigInteger.valueOf(constants.getMinGasLimit()); BigInteger targetGasLimit = minGasLimit.add(BigInteger.ONE); BigInteger usedGas = targetGasLimit.add(BigInte...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void NextBlockGasLimitIsDecreasedToMinimum() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger minGasLimit = BigInteger.valueOf(constants.getMinGasLimit()); BigInteger targetGasLimit = minGasLimit.subtract(BigInteger.ONE); BigInteger usedGas = minGasLimit.add(BigI...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void NextBlockGasLimitIsDecreasedByMaximumValue() { GasLimitCalculator calc = new GasLimitCalculator(config.getNetworkConstants()); BigInteger minGasLimit = BigInteger.valueOf(constants.getMinGasLimit()); BigInteger targetGasLimit = BigInteger.valueOf(config.getTargetGasLimit()); BigInteger usedGas = targe...
public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBoundDivisor())); if (targ...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
GasLimitCalculator { public BigInteger calculateBlockGasLimit(BigInteger parentGasLimit, BigInteger parentGasUsed, BigInteger minGasLimit, BigInteger targetGasLimit, boolean forceTarget) { BigInteger newGasLimit = parentGasLimit; BigInteger deltaMax = parentGasLimit .divide(BigInteger.valueOf(constants.getGasLimitBound...
@Test public void eventAfterBlockWithEvent() { RskTestFactory factory = new RskTestFactory(); Blockchain blockchain = factory.getBlockchain(); BlockStore blockStore = factory.getBlockStore(); RepositoryLocator repositoryLocator = factory.getRepositoryLocator(); Web3ImplLogsTest.addEmptyBlockToBlockchain(blockchain, blo...
@Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); @Overri...
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); @Overri...
@Test public void getValueWhenValueIsNull() throws Exception { Web3.CallArguments args = new Web3.CallArguments(); CallArgumentsToByteArray byteArrayArgs = new CallArgumentsToByteArray(args); Assert.assertArrayEquals(new byte[] {0}, byteArrayArgs.getValue()); }
public byte[] getValue() { byte[] value = new byte[] { 0 }; if (args.value != null && args.value.length() != 0) { value = stringHexToByteArray(args.value); } return value; }
CallArgumentsToByteArray { public byte[] getValue() { byte[] value = new byte[] { 0 }; if (args.value != null && args.value.length() != 0) { value = stringHexToByteArray(args.value); } return value; } }
CallArgumentsToByteArray { public byte[] getValue() { byte[] value = new byte[] { 0 }; if (args.value != null && args.value.length() != 0) { value = stringHexToByteArray(args.value); } return value; } CallArgumentsToByteArray(Web3.CallArguments args); }
CallArgumentsToByteArray { public byte[] getValue() { byte[] value = new byte[] { 0 }; if (args.value != null && args.value.length() != 0) { value = stringHexToByteArray(args.value); } return value; } CallArgumentsToByteArray(Web3.CallArguments args); byte[] getGasPrice(); byte[] getGasLimit(); byte[] getToAddress(); b...
CallArgumentsToByteArray { public byte[] getValue() { byte[] value = new byte[] { 0 }; if (args.value != null && args.value.length() != 0) { value = stringHexToByteArray(args.value); } return value; } CallArgumentsToByteArray(Web3.CallArguments args); byte[] getGasPrice(); byte[] getGasLimit(); byte[] getToAddress(); b...
@Test public void timestampForChildIsParentTimestampIfRegtest() { MinerClock minerClock = new MinerClock(true, clock); BlockHeader parent = mockBlockHeaderWithTimestamp(54L); assertEquals( 54L, minerClock.calculateTimestampForChild(parent) ); }
public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); }
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } }
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } M...
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } M...
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } M...
@Test public void timestampForChildIsClockTimeIfNotRegtest() { MinerClock minerClock = new MinerClock(false, clock); BlockHeader parent = mockBlockHeaderWithTimestamp(54L); assertEquals( clock.instant().getEpochSecond(), minerClock.calculateTimestampForChild(parent) ); }
public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); }
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } }
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } M...
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } M...
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } M...
@Test public void timestampForChildIsTimestampPlusOneIfNotRegtest() { MinerClock minerClock = new MinerClock(false, clock); BlockHeader parent = mockBlockHeaderWithTimestamp(clock.instant().getEpochSecond()); assertEquals( clock.instant().getEpochSecond() + 1, minerClock.calculateTimestampForChild(parent) ); }
public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); }
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } }
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } M...
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } M...
MinerClock { public long calculateTimestampForChild(BlockHeader parentHeader) { long previousTimestamp = parentHeader.getTimestamp(); if (isFixedClock) { return previousTimestamp + timeAdjustment; } long ret = clock.instant().plusSeconds(timeAdjustment).getEpochSecond(); return Long.max(ret, previousTimestamp + 1); } M...
@Test public void increaseMgp() { Coin target = Coin.valueOf(2000L); Coin prev = Coin.valueOf(1000L); MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator(target); Coin mgp = mgpCalculator.calculate(prev); Assert.assertEquals(Coin.valueOf(1010), mgp); }
public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
@Test public void decreaseMGP() { Coin prev = Coin.valueOf(1000L); Coin target = Coin.valueOf(900L); MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator(target); Coin mgp = mgpCalculator.calculate(prev); Assert.assertEquals(Coin.valueOf(990), mgp); }
public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
@Test public void mgpOnRage() { Coin prev = Coin.valueOf(1000L); Coin target = Coin.valueOf(995L); MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator(target); Coin mgp = mgpCalculator.calculate(prev); Assert.assertEquals(target, mgp); }
public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
@Test public void previousMgpEqualsTarget() { Coin prev = Coin.valueOf(1000L); Coin target = Coin.valueOf(1000L); MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator(target); Coin mgp = mgpCalculator.calculate(prev); Assert.assertEquals(target, mgp); }
public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
@Test public void previousValueIsZero() { Coin target = Coin.valueOf(1000L); MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator(target); Coin mgp = mgpCalculator.calculate(Coin.ZERO); Assert.assertEquals(Coin.valueOf(1L), mgp); }
public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
@Test public void previousValueIsSmallTargetIsZero() { Coin target = Coin.ZERO; MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator(target); Coin mgp = mgpCalculator.calculate(Coin.valueOf(1L)); Assert.assertEquals(Coin.ZERO, mgp); }
public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
@Test public void cantGetMGPtoBeNegative() { Coin previous = Coin.ZERO; Coin target = Coin.valueOf(-100L); MinimumGasPriceCalculator mgpCalculator = new MinimumGasPriceCalculator(target); previous = mgpCalculator.calculate(previous); Assert.assertTrue(previous.compareTo(Coin.valueOf(-1)) > 0); }
public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } }
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
MinimumGasPriceCalculator { public Coin calculate(Coin previousMGP) { BlockGasPriceRange priceRange = new BlockGasPriceRange(previousMGP); if (priceRange.inRange(targetMGP)) { return targetMGP; } if (previousMGP.compareTo(targetMGP) < 0) { return priceRange.getUpperLimit(); } return priceRange.getLowerLimit(); } Minimu...
@Test public void twoEventsAfterTwoBlocksWithEventAndToLatestBlock() { RskTestFactory factory = new RskTestFactory(); Blockchain blockchain = factory.getBlockchain(); BlockStore blockStore = factory.getBlockStore(); RepositoryLocator repositoryLocator = factory.getRepositoryLocator(); Web3ImplLogsTest.addEmptyBlockToBl...
@Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); @Overri...
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); @Overri...
@Test public void calculateNodeHashRate() { long ts = System.currentTimeMillis() / 1000L; Mockito.when(blockHeader.getTimestamp()).thenReturn(ts); Mockito.when(blockHeader.getCoinbase()) .thenReturn(NOT_MY_COINBASE) .thenReturn(FAKE_COINBASE) .thenReturn(FAKE_COINBASE) .thenReturn(NOT_MY_COINBASE); Mockito.when(block.g...
public abstract BigInteger calculateNodeHashRate(Duration duration);
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); }
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); }
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration duration); BigInteger calculateNetHashRate(Duratio...
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration duration); BigInteger calculateNetHashRate(Duratio...
@Test public void calculateNodeHashRateWithMiningDisabled() { long ts = System.currentTimeMillis() / 1000L; Mockito.when(blockHeader.getTimestamp()).thenReturn(ts); Mockito.when(blockHeader.getCoinbase()) .thenReturn(NOT_MY_COINBASE) .thenReturn(FAKE_COINBASE) .thenReturn(FAKE_COINBASE) .thenReturn(NOT_MY_COINBASE); Mo...
public abstract BigInteger calculateNodeHashRate(Duration duration);
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); }
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); }
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration duration); BigInteger calculateNetHashRate(Duratio...
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration duration); BigInteger calculateNetHashRate(Duratio...
@Test public void calculateNodeHashRateOldBlock() { long ts = System.currentTimeMillis() / 1000L; Mockito.when(blockHeader.getTimestamp()) .thenReturn(ts - 10000L); Mockito.when(blockHeader.getCoinbase()).thenReturn(FAKE_COINBASE); Mockito.when(block.getCumulativeDifficulty()).thenReturn(TEST_DIFFICULTY); HashRateCalcu...
public abstract BigInteger calculateNodeHashRate(Duration duration);
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); }
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); }
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration duration); BigInteger calculateNetHashRate(Duratio...
HashRateCalculator { public abstract BigInteger calculateNodeHashRate(Duration duration); HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration duration); BigInteger calculateNetHashRate(Duratio...
@Test public void calculateNetHashRate() { long ts = System.currentTimeMillis() / 1000L; Mockito.when(blockHeader.getTimestamp()).thenReturn(ts); Mockito.when(blockHeader.getCoinbase()) .thenReturn(NOT_MY_COINBASE) .thenReturn(FAKE_COINBASE) .thenReturn(FAKE_COINBASE) .thenReturn(NOT_MY_COINBASE); Mockito.when(block.ge...
public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); }
HashRateCalculator { public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); } }
HashRateCalculator { public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); } HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); }
HashRateCalculator { public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); } HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration duration); Big...
HashRateCalculator { public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); } HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration duration); Big...
@Test public void calculateNetHashRateOldBlock() { long ts = System.currentTimeMillis() / 1000L; Mockito.when(blockHeader.getTimestamp()) .thenReturn(ts - 10000L); Mockito.when(blockHeader.getCoinbase()).thenReturn(FAKE_COINBASE); Mockito.when(block.getCumulativeDifficulty()).thenReturn(TEST_DIFFICULTY); HashRateCalcul...
public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); }
HashRateCalculator { public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); } }
HashRateCalculator { public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); } HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); }
HashRateCalculator { public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); } HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration duration); Big...
HashRateCalculator { public BigInteger calculateNetHashRate(Duration period) { return calculateHashRate(b -> true, period); } HashRateCalculator(BlockStore blockStore, RskCustomCache<Keccak256, BlockHeaderElement> headerCache); void start(); void stop(); abstract BigInteger calculateNodeHashRate(Duration duration); Big...
@Test public void testAsByteList() { byte[] array = new byte[]{'a','b','c','d'}; List<Byte> result = ListArrayUtil.asByteList(array); for(int i = 0; i < array.length; i++) { Assert.assertEquals(array[i], result.get(i).byteValue()); } }
public static List<Byte> asByteList(byte[] primitiveByteArray) { Byte[] arrayObj = convertTo(primitiveByteArray); return Arrays.asList(arrayObj); }
ListArrayUtil { public static List<Byte> asByteList(byte[] primitiveByteArray) { Byte[] arrayObj = convertTo(primitiveByteArray); return Arrays.asList(arrayObj); } }
ListArrayUtil { public static List<Byte> asByteList(byte[] primitiveByteArray) { Byte[] arrayObj = convertTo(primitiveByteArray); return Arrays.asList(arrayObj); } private ListArrayUtil(); }
ListArrayUtil { public static List<Byte> asByteList(byte[] primitiveByteArray) { Byte[] arrayObj = convertTo(primitiveByteArray); return Arrays.asList(arrayObj); } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nul...
ListArrayUtil { public static List<Byte> asByteList(byte[] primitiveByteArray) { Byte[] arrayObj = convertTo(primitiveByteArray); return Arrays.asList(arrayObj); } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nul...
@Test public void testNullIsEmpty() { Assert.assertTrue(ListArrayUtil.isEmpty(null)); }
public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; }
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } }
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } private ListArrayUtil(); }
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[] nullToEmpty(...
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[] nullToEmpty(...
@Test public void testEmptyIsEmpty() { Assert.assertTrue(ListArrayUtil.isEmpty(new byte[]{})); }
public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; }
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } }
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } private ListArrayUtil(); }
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[] nullToEmpty(...
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[] nullToEmpty(...
@Test public void testNotEmptyIsEmpty() { Assert.assertFalse(ListArrayUtil.isEmpty(new byte[]{'a'})); }
public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; }
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } }
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } private ListArrayUtil(); }
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[] nullToEmpty(...
ListArrayUtil { public static boolean isEmpty(@Nullable byte[] array) { return array == null || array.length == 0; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[] nullToEmpty(...
@Test public void testNullToEmpty() { Assert.assertNotNull(ListArrayUtil.nullToEmpty(null)); }
public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; }
ListArrayUtil { public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; } }
ListArrayUtil { public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; } private ListArrayUtil(); }
ListArrayUtil { public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static by...
ListArrayUtil { public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static by...
@Test public void onlyOneEventAfterTwoBlocksWithEventAndFromLatestBlock() { RskTestFactory factory = new RskTestFactory(); Blockchain blockchain = factory.getBlockchain(); BlockStore blockStore = factory.getBlockStore(); RepositoryLocator repositoryLocator = factory.getRepositoryLocator(); Web3ImplLogsTest.addEmptyBloc...
@Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); }
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); @Overri...
LogFilter extends Filter { @Override public void newBlockReceived(Block b) { if (this.fromLatestBlock) { this.clearEvents(); onBlock(b); } else if (this.toLatestBlock) { onBlock(b); } } LogFilter(AddressesTopicsFilter addressesTopicsFilter, Blockchain blockchain, boolean fromLatestBlock, boolean toLatestBlock); @Overri...
@Test public void testNonNullToEmpty() { byte[] array = new byte[1]; Assert.assertSame(array, ListArrayUtil.nullToEmpty(array)); }
public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; }
ListArrayUtil { public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; } }
ListArrayUtil { public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; } private ListArrayUtil(); }
ListArrayUtil { public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static by...
ListArrayUtil { public static byte[] nullToEmpty(@Nullable byte[] array) { if (array == null) { return new byte[0]; } return array; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static by...
@Test public void testNullGetLength() { Assert.assertEquals(0, ListArrayUtil.getLength(null)); }
public static int getLength(@Nullable byte[] array) { if (array == null) { return 0; } return array.length; }
ListArrayUtil { public static int getLength(@Nullable byte[] array) { if (array == null) { return 0; } return array.length; } }
ListArrayUtil { public static int getLength(@Nullable byte[] array) { if (array == null) { return 0; } return array.length; } private ListArrayUtil(); }
ListArrayUtil { public static int getLength(@Nullable byte[] array) { if (array == null) { return 0; } return array.length; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[] nul...
ListArrayUtil { public static int getLength(@Nullable byte[] array) { if (array == null) { return 0; } return array.length; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[] nul...
@Test public void testNonNullGetLength() { byte[] array = new byte[1]; Assert.assertEquals(1, ListArrayUtil.getLength(array)); }
public static int getLength(@Nullable byte[] array) { if (array == null) { return 0; } return array.length; }
ListArrayUtil { public static int getLength(@Nullable byte[] array) { if (array == null) { return 0; } return array.length; } }
ListArrayUtil { public static int getLength(@Nullable byte[] array) { if (array == null) { return 0; } return array.length; } private ListArrayUtil(); }
ListArrayUtil { public static int getLength(@Nullable byte[] array) { if (array == null) { return 0; } return array.length; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[] nul...
ListArrayUtil { public static int getLength(@Nullable byte[] array) { if (array == null) { return 0; } return array.length; } private ListArrayUtil(); static List<Byte> asByteList(byte[] primitiveByteArray); static boolean isEmpty(@Nullable byte[] array); static int getLength(@Nullable byte[] array); static byte[] nul...
@Test public void testLastIndexOfSublistEmptyArrays() { byte[] source = new byte[] {}; byte[] target = new byte[] {}; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals( 0, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistSearchEmpty() { byte[] source = new byte[] { 1, 2, 3, 4, 5 }; byte[] target = new byte[] { }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(5, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistFindsMatch1() { byte[] source = new byte[] { 1, 2, 3, 4, 5 }; byte[] target = new byte[] { 3, 4 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(2, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistFindsMatch2() { byte[] source = new byte[] { 1, 2, 3, 4, 5 }; byte[] target = new byte[] { 4, 5 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(3, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistSameArray() { byte[] source = new byte[] { 1, 2, 3, 4, 5 }; byte[] target = new byte[] { 1, 2, 3, 4, 5 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(0, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistTargetLongerThanSource() { byte[] source = new byte[] { 1, 2, 3, 4, 5 }; byte[] target = new byte[] { 1, 2, 3, 4, 5, 6 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(-1, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistPartialOverlapOnBeginning() { byte[] source = new byte[] { 1, 2, 3, 4, 5 }; byte[] target = new byte[] { 0, 1, 2 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(-1, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testEquals() { Topic topicA = new Topic("0000000000000000000000000000000000000000000000000000000000000001"); Topic topicB = new Topic("0000000000000000000000000000000000000000000000000000000000000001"); Topic topicC = new Topic("0000000000000000000000000000000000000000000000000000000000000002"); Topic...
@Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } Topic otherTopic = (Topic) other; return Arrays.equals(bytes, otherTopic.bytes); }
Topic { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } Topic otherTopic = (Topic) other; return Arrays.equals(bytes, otherTopic.bytes); } }
Topic { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } Topic otherTopic = (Topic) other; return Arrays.equals(bytes, otherTopic.bytes); } Topic(String topic); Topic(byte[] bytes); }
Topic { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } Topic otherTopic = (Topic) other; return Arrays.equals(bytes, otherTopic.bytes); } Topic(String topic); Topic(byte[] bytes); byte[] getBytes(); @Overri...
Topic { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } Topic otherTopic = (Topic) other; return Arrays.equals(bytes, otherTopic.bytes); } Topic(String topic); Topic(byte[] bytes); byte[] getBytes(); @Overri...
@Test public void testLastIndexOfSublistPartialOverlapOnEnd() { byte[] source = new byte[] { 1, 2, 3, 4, 5 }; byte[] target = new byte[] { 4, 5, 6 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(-1, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublist6ArraysWithNoSharedElements() { byte[] source = new byte[] { 1, 2, 3, 4, 5 }; byte[] target = new byte[] { 6, 7, 8, 9, 10 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(-1, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistNullSource() { byte[] source = null; byte[] target = new byte[] { 6, 7, 8, 9, 10 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(-1, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistNullTarget() { byte[] source = new byte[] { 1, 2, 3, 4, 5 }; byte[] target = null; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(-1, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistMatchesSecondOcurrence() { byte[] source = new byte[] { 3, 4, 5, 3, 4, 5 }; byte[] target = new byte[] { 3, 4, 5 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(3, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistMatchesThirdOcurrence() { byte[] source = new byte[] { 1, 2, 3, 1, 2, 3, 1, 2, 3 }; byte[] target = new byte[] { 1, 2, 3 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(6, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
@Test public void testLastIndexOfSublistMatchesLastOcurrence() { byte[] source = new byte[] { 1, 2, 3, 3, 4, 5, 1, 2, 3 }; byte[] target = new byte[] { 1, 2, 3 }; int res = ListArrayUtil.lastIndexOfSubList(source, target); Assert.assertEquals(6, res); }
public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { boolean found = tr...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...
ListArrayUtil { public static int lastIndexOfSubList(byte[] source, byte[] target) { if (source == null || target == null) { return -1; } if (target.length == 0) { return source.length; } if (source.length < target.length) { return -1; } final int max = source.length - target.length; for (int i = max; i >= 0; i--) { bo...