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 addLargeValues() { BlockDifficulty d1 = new BlockDifficulty(BigInteger.valueOf(Long.MAX_VALUE)); BlockDifficulty d2 = new BlockDifficulty(BigInteger.valueOf(Integer.MAX_VALUE)); assertThat(d1.add(d2), is(new BlockDifficulty(new BigInteger("9223372039002259454")))); }
public BlockDifficulty add(BlockDifficulty other) { return new BlockDifficulty(value.add(other.value)); }
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { public BlockDifficulty add(BlockDifficulty other) { return new BlockDifficulty(value.add(other.value)); } }
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { public BlockDifficulty add(BlockDifficulty other) { return new BlockDifficulty(value.add(other.value)); } BlockDifficulty(BigInteger value); }
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { public BlockDifficulty add(BlockDifficulty other) { return new BlockDifficulty(value.add(other.value)); } BlockDifficulty(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); @Override boolean equals(Object other); @Override int hashCode...
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { public BlockDifficulty add(BlockDifficulty other) { return new BlockDifficulty(value.add(other.value)); } BlockDifficulty(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); @Override boolean equals(Object other); @Override int hashCode...
@Test public void testEncodeBigInteger() { BigInteger test = new BigInteger("100102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", 16); String expected = "a0100102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"; byte[] encoderesult = encode(test); assertEquals(expected, ByteUtil.toHexString(enc...
public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } }
RLP { public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } } }
RLP { public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } } }
RLP { public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } } static int decodeInt(byte[] data, int index); static BigInteger decodeBigInteger(byte[] data, int inde...
RLP { public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } } static int decodeInt(byte[] data, int index); static BigInteger decodeBigInteger(byte[] data, int inde...
@Test public void eth_protocolVersion() throws Exception { World world = new World(); Web3Impl web3 = createWeb3(world); String netVersion = web3.eth_protocolVersion(); assertTrue("RSK net version different than one", netVersion.compareTo("1") == 0); }
@Override public String eth_protocolVersion() { return rsk_protocolVersion(); }
Web3Impl implements Web3 { @Override public String eth_protocolVersion() { return rsk_protocolVersion(); } }
Web3Impl implements Web3 { @Override public String eth_protocolVersion() { return rsk_protocolVersion(); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSystemProperties config, Miner...
Web3Impl implements Web3 { @Override public String eth_protocolVersion() { return rsk_protocolVersion(); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSystemProperties config, Miner...
Web3Impl implements Web3 { @Override public String eth_protocolVersion() { return rsk_protocolVersion(); } protected Web3Impl( Ethereum eth, Blockchain blockchain, BlockStore blockStore, ReceiptStore receiptStore, RskSystemProperties config, Miner...
@Test public void testComparable() { BlockDifficulty zero = BlockDifficulty.ZERO; BlockDifficulty d1 = new BlockDifficulty(BigInteger.valueOf(Long.MAX_VALUE)); BlockDifficulty d2 = new BlockDifficulty(BigInteger.valueOf(Integer.MAX_VALUE)); assertThat(zero.compareTo(zero), is(0)); assertThat(d1.compareTo(d1), is(0)); a...
@Override public int compareTo(@Nonnull BlockDifficulty other) { return value.compareTo(other.value); }
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { @Override public int compareTo(@Nonnull BlockDifficulty other) { return value.compareTo(other.value); } }
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { @Override public int compareTo(@Nonnull BlockDifficulty other) { return value.compareTo(other.value); } BlockDifficulty(BigInteger value); }
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { @Override public int compareTo(@Nonnull BlockDifficulty other) { return value.compareTo(other.value); } BlockDifficulty(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); @Override boolean equals(Object other); @Override int hashCode()...
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { @Override public int compareTo(@Nonnull BlockDifficulty other) { return value.compareTo(other.value); } BlockDifficulty(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); @Override boolean equals(Object other); @Override int hashCode()...
@Test public void getEmptyAccountList() { Wallet wallet = WalletFactory.createWallet(); List<byte[]> addresses = wallet.getAccountAddresses(); Assert.assertNotNull(addresses); Assert.assertTrue(addresses.isEmpty()); }
public List<byte[]> getAccountAddresses() { List<byte[]> addresses = new ArrayList<>(); Set<RskAddress> keys = new HashSet<>(); synchronized(accessLock) { for (RskAddress addr: this.initialAccounts) { addresses.add(addr.getBytes()); } for (byte[] address: keyDS.keys()) { keys.add(new RskAddress(address)); } keys.addAll...
Wallet { public List<byte[]> getAccountAddresses() { List<byte[]> addresses = new ArrayList<>(); Set<RskAddress> keys = new HashSet<>(); synchronized(accessLock) { for (RskAddress addr: this.initialAccounts) { addresses.add(addr.getBytes()); } for (byte[] address: keyDS.keys()) { keys.add(new RskAddress(address)); } ke...
Wallet { public List<byte[]> getAccountAddresses() { List<byte[]> addresses = new ArrayList<>(); Set<RskAddress> keys = new HashSet<>(); synchronized(accessLock) { for (RskAddress addr: this.initialAccounts) { addresses.add(addr.getBytes()); } for (byte[] address: keyDS.keys()) { keys.add(new RskAddress(address)); } ke...
Wallet { public List<byte[]> getAccountAddresses() { List<byte[]> addresses = new ArrayList<>(); Set<RskAddress> keys = new HashSet<>(); synchronized(accessLock) { for (RskAddress addr: this.initialAccounts) { addresses.add(addr.getBytes()); } for (byte[] address: keyDS.keys()) { keys.add(new RskAddress(address)); } ke...
Wallet { public List<byte[]> getAccountAddresses() { List<byte[]> addresses = new ArrayList<>(); Set<RskAddress> keys = new HashSet<>(); synchronized(accessLock) { for (RskAddress addr: this.initialAccounts) { addresses.add(addr.getBytes()); } for (byte[] address: keyDS.keys()) { keys.add(new RskAddress(address)); } ke...
@Test public void addAccountWithSeed() { Wallet wallet = WalletFactory.createWallet(); byte[] address = wallet.addAccountWithSeed("seed"); Assert.assertNotNull(address); byte[] calculatedAddress = ECKey.fromPrivate(Keccak256Helper.keccak256("seed".getBytes())).getAddress(); Assert.assertArrayEquals(calculatedAddress, a...
public byte[] addAccountWithSeed(String seed) { return addAccountWithPrivateKey(Keccak256Helper.keccak256(seed.getBytes(StandardCharsets.UTF_8))); }
Wallet { public byte[] addAccountWithSeed(String seed) { return addAccountWithPrivateKey(Keccak256Helper.keccak256(seed.getBytes(StandardCharsets.UTF_8))); } }
Wallet { public byte[] addAccountWithSeed(String seed) { return addAccountWithPrivateKey(Keccak256Helper.keccak256(seed.getBytes(StandardCharsets.UTF_8))); } Wallet(KeyValueDataSource keyDS); }
Wallet { public byte[] addAccountWithSeed(String seed) { return addAccountWithPrivateKey(Keccak256Helper.keccak256(seed.getBytes(StandardCharsets.UTF_8))); } Wallet(KeyValueDataSource keyDS); List<byte[]> getAccountAddresses(); String[] getAccountAddressesAsHex(); RskAddress addAccount(); RskAddress addAccount(String p...
Wallet { public byte[] addAccountWithSeed(String seed) { return addAccountWithPrivateKey(Keccak256Helper.keccak256(seed.getBytes(StandardCharsets.UTF_8))); } Wallet(KeyValueDataSource keyDS); List<byte[]> getAccountAddresses(); String[] getAccountAddressesAsHex(); RskAddress addAccount(); RskAddress addAccount(String p...
@Test public void unlockNonexistentAccount() { Wallet wallet = WalletFactory.createWallet(); RskAddress addr = new RskAddress("0x0000000000000000000000000000000000000023"); Assert.assertFalse(wallet.unlockAccount(addr, "passphrase")); }
public boolean unlockAccount(RskAddress addr, String passphrase, long duration) { long ending = System.currentTimeMillis() + duration; boolean unlocked = unlockAccount(addr, passphrase); if (unlocked) { synchronized (accessLock) { unlocksTimeouts.put(addr, ending); } } return unlocked; }
Wallet { public boolean unlockAccount(RskAddress addr, String passphrase, long duration) { long ending = System.currentTimeMillis() + duration; boolean unlocked = unlockAccount(addr, passphrase); if (unlocked) { synchronized (accessLock) { unlocksTimeouts.put(addr, ending); } } return unlocked; } }
Wallet { public boolean unlockAccount(RskAddress addr, String passphrase, long duration) { long ending = System.currentTimeMillis() + duration; boolean unlocked = unlockAccount(addr, passphrase); if (unlocked) { synchronized (accessLock) { unlocksTimeouts.put(addr, ending); } } return unlocked; } Wallet(KeyValueDataSou...
Wallet { public boolean unlockAccount(RskAddress addr, String passphrase, long duration) { long ending = System.currentTimeMillis() + duration; boolean unlocked = unlockAccount(addr, passphrase); if (unlocked) { synchronized (accessLock) { unlocksTimeouts.put(addr, ending); } } return unlocked; } Wallet(KeyValueDataSou...
Wallet { public boolean unlockAccount(RskAddress addr, String passphrase, long duration) { long ending = System.currentTimeMillis() + duration; boolean unlocked = unlockAccount(addr, passphrase); if (unlocked) { synchronized (accessLock) { unlocksTimeouts.put(addr, ending); } } return unlocked; } Wallet(KeyValueDataSou...
@Test public void lockAccount() { Wallet wallet = WalletFactory.createWallet(); byte[] address = wallet.addAccount("passphrase").getBytes(); Assert.assertNotNull(address); Assert.assertTrue(wallet.unlockAccount(new RskAddress(address), "passphrase")); Account account = wallet.getAccount(new RskAddress(address)); Assert...
public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } }
Wallet { public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } } }
Wallet { public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } } Wallet(KeyValueDataSource keyDS); }
Wallet { public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } } Wallet(KeyValueDataSource keyDS); List<byte[]> getAccountAddresses(); String[] getAccountAddressesAsHex(); RskAddress addAccount(); RskAddress add...
Wallet { public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } } Wallet(KeyValueDataSource keyDS); List<byte[]> getAccountAddresses(); String[] getAccountAddressesAsHex(); RskAddress addAccount(); RskAddress add...
@Test public void lockNonexistentAccount() { Wallet wallet = WalletFactory.createWallet(); RskAddress addr = new RskAddress("0x0000000000000000000000000000000000000023"); Assert.assertFalse(wallet.lockAccount(addr)); }
public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } }
Wallet { public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } } }
Wallet { public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } } Wallet(KeyValueDataSource keyDS); }
Wallet { public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } } Wallet(KeyValueDataSource keyDS); List<byte[]> getAccountAddresses(); String[] getAccountAddressesAsHex(); RskAddress addAccount(); RskAddress add...
Wallet { public boolean lockAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return false; } accounts.remove(addr); return true; } } Wallet(KeyValueDataSource keyDS); List<byte[]> getAccountAddresses(); String[] getAccountAddressesAsHex(); RskAddress addAccount(); RskAddress add...
@Test public void getUnknownAccount() { Wallet wallet = WalletFactory.createWallet(); RskAddress addr = new RskAddress("0x0000000000000000000000000000000000000023"); Account account = wallet.getAccount(addr); Assert.assertNull(account); }
public Account getAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return null; } if (unlocksTimeouts.containsKey(addr)) { long ending = unlocksTimeouts.get(addr); long time = System.currentTimeMillis(); if (ending < time) { unlocksTimeouts.remove(addr); accounts.remove(addr); r...
Wallet { public Account getAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return null; } if (unlocksTimeouts.containsKey(addr)) { long ending = unlocksTimeouts.get(addr); long time = System.currentTimeMillis(); if (ending < time) { unlocksTimeouts.remove(addr); accounts.remove...
Wallet { public Account getAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return null; } if (unlocksTimeouts.containsKey(addr)) { long ending = unlocksTimeouts.get(addr); long time = System.currentTimeMillis(); if (ending < time) { unlocksTimeouts.remove(addr); accounts.remove...
Wallet { public Account getAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return null; } if (unlocksTimeouts.containsKey(addr)) { long ending = unlocksTimeouts.get(addr); long time = System.currentTimeMillis(); if (ending < time) { unlocksTimeouts.remove(addr); accounts.remove...
Wallet { public Account getAccount(RskAddress addr) { synchronized (accessLock) { if (!accounts.containsKey(addr)) { return null; } if (unlocksTimeouts.containsKey(addr)) { long ending = unlocksTimeouts.get(addr); long time = System.currentTimeMillis(); if (ending < time) { unlocksTimeouts.remove(addr); accounts.remove...
@Test public void addAccountWithPrivateKey() { Wallet wallet = WalletFactory.createWallet(); byte[] privateKeyBytes = Keccak256Helper.keccak256("seed".getBytes()); byte[] address = wallet.addAccountWithPrivateKey(privateKeyBytes); Assert.assertNotNull(address); byte[] calculatedAddress = ECKey.fromPrivate(Keccak256Help...
public byte[] addAccountWithPrivateKey(byte[] privateKeyBytes) { Account account = new Account(ECKey.fromPrivate(privateKeyBytes)); synchronized (accessLock) { RskAddress addr = addAccount(account); if (!this.initialAccounts.contains(addr)) { this.initialAccounts.add(addr); } return addr.getBytes(); } }
Wallet { public byte[] addAccountWithPrivateKey(byte[] privateKeyBytes) { Account account = new Account(ECKey.fromPrivate(privateKeyBytes)); synchronized (accessLock) { RskAddress addr = addAccount(account); if (!this.initialAccounts.contains(addr)) { this.initialAccounts.add(addr); } return addr.getBytes(); } } }
Wallet { public byte[] addAccountWithPrivateKey(byte[] privateKeyBytes) { Account account = new Account(ECKey.fromPrivate(privateKeyBytes)); synchronized (accessLock) { RskAddress addr = addAccount(account); if (!this.initialAccounts.contains(addr)) { this.initialAccounts.add(addr); } return addr.getBytes(); } } Wallet...
Wallet { public byte[] addAccountWithPrivateKey(byte[] privateKeyBytes) { Account account = new Account(ECKey.fromPrivate(privateKeyBytes)); synchronized (accessLock) { RskAddress addr = addAccount(account); if (!this.initialAccounts.contains(addr)) { this.initialAccounts.add(addr); } return addr.getBytes(); } } Wallet...
Wallet { public byte[] addAccountWithPrivateKey(byte[] privateKeyBytes) { Account account = new Account(ECKey.fromPrivate(privateKeyBytes)); synchronized (accessLock) { RskAddress addr = addAccount(account); if (!this.initialAccounts.contains(addr)) { this.initialAccounts.add(addr); } return addr.getBytes(); } } Wallet...
@Test public void createWithNoSnapshot() { Assert.assertNotNull(manager.getSnapshots()); Assert.assertTrue(manager.getSnapshots().isEmpty()); }
@VisibleForTesting public List<Long> getSnapshots() { return this.snapshots; }
SnapshotManager { @VisibleForTesting public List<Long> getSnapshots() { return this.snapshots; } }
SnapshotManager { @VisibleForTesting public List<Long> getSnapshots() { return this.snapshots; } SnapshotManager( Blockchain blockchain, BlockStore blockStore, TransactionPool transactionPool, MinerServer minerServer); }
SnapshotManager { @VisibleForTesting public List<Long> getSnapshots() { return this.snapshots; } SnapshotManager( Blockchain blockchain, BlockStore blockStore, TransactionPool transactionPool, MinerServer minerServer); int takeSnapshot(); boolean resetSnapshots(); boolean...
SnapshotManager { @VisibleForTesting public List<Long> getSnapshots() { return this.snapshots; } SnapshotManager( Blockchain blockchain, BlockStore blockStore, TransactionPool transactionPool, MinerServer minerServer); int takeSnapshot(); boolean resetSnapshots(); boolean...
@Test public void revertToNegativeSnapshot() { Assert.assertFalse(manager.revertToSnapshot(-1)); }
public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNumber = blockchain.g...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
@Test public void testRlpEncode() { assertEquals(result01, ByteUtil.toHexString(encode(test01))); assertEquals(result02, ByteUtil.toHexString(encode(test02))); assertEquals(result03, ByteUtil.toHexString(encode(test03))); assertEquals(result04, ByteUtil.toHexString(encode(test04))); assertEquals(result05, ByteUtil.toHe...
public static byte[] encode(Object input) { Value val = new Value(input); if (val.isList()) { List<Object> inputArray = val.asList(); if (inputArray.isEmpty()) { return encodeLength(inputArray.size(), OFFSET_SHORT_LIST); } byte[] output = ByteUtil.EMPTY_BYTE_ARRAY; for (Object object : inputArray) { output = concatenat...
RLP { public static byte[] encode(Object input) { Value val = new Value(input); if (val.isList()) { List<Object> inputArray = val.asList(); if (inputArray.isEmpty()) { return encodeLength(inputArray.size(), OFFSET_SHORT_LIST); } byte[] output = ByteUtil.EMPTY_BYTE_ARRAY; for (Object object : inputArray) { output = conc...
RLP { public static byte[] encode(Object input) { Value val = new Value(input); if (val.isList()) { List<Object> inputArray = val.asList(); if (inputArray.isEmpty()) { return encodeLength(inputArray.size(), OFFSET_SHORT_LIST); } byte[] output = ByteUtil.EMPTY_BYTE_ARRAY; for (Object object : inputArray) { output = conc...
RLP { public static byte[] encode(Object input) { Value val = new Value(input); if (val.isList()) { List<Object> inputArray = val.asList(); if (inputArray.isEmpty()) { return encodeLength(inputArray.size(), OFFSET_SHORT_LIST); } byte[] output = ByteUtil.EMPTY_BYTE_ARRAY; for (Object object : inputArray) { output = conc...
RLP { public static byte[] encode(Object input) { Value val = new Value(input); if (val.isList()) { List<Object> inputArray = val.asList(); if (inputArray.isEmpty()) { return encodeLength(inputArray.size(), OFFSET_SHORT_LIST); } byte[] output = ByteUtil.EMPTY_BYTE_ARRAY; for (Object object : inputArray) { output = conc...
@Test public void revertToNonExistentSnapshot() { Assert.assertFalse(manager.revertToSnapshot(0)); Assert.assertFalse(manager.revertToSnapshot(1)); Assert.assertFalse(manager.revertToSnapshot(10)); }
public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNumber = blockchain.g...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
@Test public void revertToSnapshot() { addBlocks(10); BlockChainStatus status = blockchain.getStatus(); int snapshotId = manager.takeSnapshot(); addBlocks(20); Assert.assertEquals(30, blockchain.getStatus().getBestBlockNumber()); Assert.assertTrue(manager.revertToSnapshot(snapshotId)); BlockChainStatus newStatus = bloc...
public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNumber = blockchain.g...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
SnapshotManager { public boolean revertToSnapshot(int snapshotId) { if (snapshotId <= 0 || snapshotId > this.snapshots.size()) { return false; } long newBestBlockNumber = this.snapshots.get(snapshotId - 1); this.snapshots = this.snapshots.stream().limit(snapshotId).collect(Collectors.toList()); long currentBestBlockNum...
@Test public void executeTransactionHello() { TestContract hello = TestContract.hello(); CallTransaction.Function helloFn = hello.functions.get("hello"); RskAddress contractAddress = contractRunner.addContract(hello.runtimeBytecode); RskAddress from = TestUtils.randomAddress(); byte[] gasPrice = Hex.decode("00"); byte[...
public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), executionBlock, coinbase, gasPrice,...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
@Test public void executeTransactionGreeterOtherSender() { TestContract greeter = TestContract.greeter(); CallTransaction.Function greeterFn = greeter.functions.get("greet"); RskAddress contractAddress = contractRunner.addContract(greeter.runtimeBytecode); RskAddress from = new RskAddress("00000000000000000000000000000...
public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), executionBlock, coinbase, gasPrice,...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
@Test public void executeTransactionCountCallsMultipleTimes() { TestContract countcalls = TestContract.countcalls(); CallTransaction.Function callsFn = countcalls.functions.get("calls"); RskAddress contractAddress = contractRunner.addContract(countcalls.runtimeBytecode); RskAddress from = new RskAddress("00000000000000...
public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), executionBlock, coinbase, gasPrice,...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
ReversibleTransactionExecutor { public ProgramResult executeTransaction( Block executionBlock, RskAddress coinbase, byte[] gasPrice, byte[] gasLimit, byte[] toAddress, byte[] value, byte[] data, RskAddress fromAddress) { return executeTransaction_workaround( repositoryLocator.snapshotAt(executionBlock.getHeader()), exe...
@Test public void getWithHeightZeroReturnsEmpty() { BlockStore blockStore = mock(BlockStore.class); ConsensusValidationMainchainView view = new ConsensusValidationMainchainViewImpl(blockStore); List<BlockHeader> result = view.get(new Keccak256(getRandomHash()), 0); assertNotNull(result); assertThat(result.size(), is(0)...
@Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height; i++) { Block block = blockStore.getBlockByHash(currentHash.getBytes()); BlockHeade...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
@Test public void getThatFindsAllBlocksOnBlockStore() { BlockStore blockStore = createBlockStore(10); ConsensusValidationMainchainView view = new ConsensusValidationMainchainViewImpl(blockStore); Block bestBlock = blockStore.getBestBlock(); List<BlockHeader> result = view.get(bestBlock.getHash(), 5); assertNotNull(resu...
@Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height; i++) { Block block = blockStore.getBlockByHash(currentHash.getBytes()); BlockHeade...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
@Test public void getAllBlocksOnBlockStoreAreAllRequestedBlocks() { BlockStore blockStore = createBlockStore(5); ConsensusValidationMainchainView view = new ConsensusValidationMainchainViewImpl(blockStore); Block bestBlock = blockStore.getBestBlock(); List<BlockHeader> result = view.get(bestBlock.getHash(), 5); assertN...
@Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height; i++) { Block block = blockStore.getBlockByHash(currentHash.getBytes()); BlockHeade...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
ConsensusValidationMainchainViewImpl implements ConsensusValidationMainchainView { @Override public synchronized List<BlockHeader> get(Keccak256 startingHashToGetMainchainFrom, int height) { List<BlockHeader> headers = new ArrayList<>(); Keccak256 currentHash = startingHashToGetMainchainFrom; for(int i = 0; i < height;...
@Test public void calculateParentChild() { BlockStore store = createBlockStore(); BlockGenerator blockGenerator = new BlockGenerator(); Block genesis = blockGenerator.getGenesisBlock(); Block block = blockGenerator.createChildBlock(genesis); store.saveBlock(genesis, TEST_DIFFICULTY, true); store.saveBlock(block, TEST_D...
public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(oldBlock, oldBlocks, newBlocks...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
@Test public void calculateForkLengthTwo() { BlockStore store = createBlockStore(); BlockGenerator blockGenerator = new BlockGenerator(); Block genesis = blockGenerator.getGenesisBlock(); Block parent = blockGenerator.createChildBlock(genesis); store.saveBlock(genesis, TEST_DIFFICULTY, true); store.saveBlock(parent, TE...
public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(oldBlock, oldBlocks, newBlocks...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
@Test public void testRlpDecode() { int pos = 0; String emptyString; byte[] decodedData; RLPList decodedList; emptyString = ByteUtil.toHexStringOrEmpty(decode2(Hex.decode(result01)).get(0).getRLPData()); assertEquals("", emptyString); emptyString = ByteUtil.toHexStringOrEmpty(decode2(Hex.decode(result02)).get(0).getRLP...
@Nonnull public static ArrayList<RLPElement> decode2(@CheckForNull byte[] msgData) { ArrayList<RLPElement> elements = new ArrayList<>(); if (msgData == null) { return elements; } int tlength = msgData.length; int position = 0; while (position < tlength) { Pair<RLPElement, Integer> next = decodeElement(msgData, position...
RLP { @Nonnull public static ArrayList<RLPElement> decode2(@CheckForNull byte[] msgData) { ArrayList<RLPElement> elements = new ArrayList<>(); if (msgData == null) { return elements; } int tlength = msgData.length; int position = 0; while (position < tlength) { Pair<RLPElement, Integer> next = decodeElement(msgData, po...
RLP { @Nonnull public static ArrayList<RLPElement> decode2(@CheckForNull byte[] msgData) { ArrayList<RLPElement> elements = new ArrayList<>(); if (msgData == null) { return elements; } int tlength = msgData.length; int position = 0; while (position < tlength) { Pair<RLPElement, Integer> next = decodeElement(msgData, po...
RLP { @Nonnull public static ArrayList<RLPElement> decode2(@CheckForNull byte[] msgData) { ArrayList<RLPElement> elements = new ArrayList<>(); if (msgData == null) { return elements; } int tlength = msgData.length; int position = 0; while (position < tlength) { Pair<RLPElement, Integer> next = decodeElement(msgData, po...
RLP { @Nonnull public static ArrayList<RLPElement> decode2(@CheckForNull byte[] msgData) { ArrayList<RLPElement> elements = new ArrayList<>(); if (msgData == null) { return elements; } int tlength = msgData.length; int position = 0; while (position < tlength) { Pair<RLPElement, Integer> next = decodeElement(msgData, po...
@Test public void calculateForkLengthTwoOldThreeNew() { BlockStore store = createBlockStore(); BlockGenerator blockGenerator = new BlockGenerator(); Block genesis = blockGenerator.getGenesisBlock(); Block parent = blockGenerator.createChildBlock(genesis); store.saveBlock(genesis, TEST_DIFFICULTY, true); store.saveBlock...
public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(oldBlock, oldBlocks, newBlocks...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
@Test public void calculateForkLengthThreeOldTwoNew() { BlockStore store = createBlockStore(); BlockGenerator blockGenerator = new BlockGenerator(); Block genesis = blockGenerator.getGenesisBlock(); Block parent = blockGenerator.createChildBlock(genesis); store.saveBlock(genesis, TEST_DIFFICULTY, true); store.saveBlock...
public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(oldBlock, oldBlocks, newBlocks...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
BlockchainBranchComparator { public BlockFork calculateFork(Block fromBlock, Block toBlock) { List<Block> oldBlocks = new LinkedList<>(); List<Block> newBlocks = new LinkedList<>(); Block oldBlock = fromBlock; Block newBlock = toBlock; if (oldBlock.isParentOf(newBlock)) { newBlocks.add(newBlock); return new BlockFork(o...
@Test public void getFamilyGetParent() { BlockStore store = createBlockStore(); BlockGenerator blockGenerator = new BlockGenerator(); Block genesis = blockGenerator.getGenesisBlock(); Block block1 = blockGenerator.createChildBlock(genesis); store.saveBlock(genesis, TEST_DIFFICULTY, true); store.saveBlock(block1, TEST_D...
public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockStore blockStore, ...
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockStore blockStore, ...
@Test public void getEmptyFamilyForGenesis() { BlockStore store = createBlockStore(); Block genesis = new BlockGenerator().getGenesisBlock(); store.saveBlock(genesis, TEST_DIFFICULTY, true); Set<Keccak256> family = FamilyUtils.getFamily(store, genesis, 6); Assert.assertNotNull(family); Assert.assertTrue(family.isEmpty(...
public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockStore blockStore, ...
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockStore blockStore, ...
@Test public void getFamilyGetAncestorsUpToLevel() { BlockStore store = createBlockStore(); BlockGenerator blockGenerator = new BlockGenerator(); Block genesis = blockGenerator.getGenesisBlock(); Block block1 = blockGenerator.createChildBlock(genesis); Block block2 = blockGenerator.createChildBlock(block1); Block block...
public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockStore blockStore, ...
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockStore blockStore, ...
@Test public void getFamilyGetAncestorsWithUncles() { BlockStore store = createBlockStore(); BlockGenerator blockGenerator = new BlockGenerator(); Block genesis = blockGenerator.getGenesisBlock(); Block block1 = blockGenerator.createChildBlock(genesis); Block uncle11 = blockGenerator.createChildBlock(genesis); Block un...
public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockStore blockStore, ...
FamilyUtils { public static Set<Keccak256> getFamily(BlockStore store, Block block, int levels) { return getFamily(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockStore blockStore, ...
@Test public void getUnclesHeaders() { BlockStore store = createBlockStore(); BlockGenerator blockGenerator = new BlockGenerator(); Block genesis = blockGenerator.getGenesisBlock(); Block block1 = blockGenerator.createChildBlock(genesis); Block uncle11 = blockGenerator.createChildBlock(genesis); Block uncle111 = blockG...
public static List<BlockHeader> getUnclesHeaders(BlockStore store, Block block, int levels) { return getUnclesHeaders(store, block.getNumber(), block.getParentHash(), levels); }
FamilyUtils { public static List<BlockHeader> getUnclesHeaders(BlockStore store, Block block, int levels) { return getUnclesHeaders(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static List<BlockHeader> getUnclesHeaders(BlockStore store, Block block, int levels) { return getUnclesHeaders(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static List<BlockHeader> getUnclesHeaders(BlockStore store, Block block, int levels) { return getUnclesHeaders(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockS...
FamilyUtils { public static List<BlockHeader> getUnclesHeaders(BlockStore store, Block block, int levels) { return getUnclesHeaders(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockS...
@Test public void getUncles() { BlockStore store = createBlockStore(); BlockGenerator blockGenerator = new BlockGenerator(); Block genesis = blockGenerator.getGenesisBlock(); Block block1 = blockGenerator.createChildBlock(genesis); Block uncle11 = blockGenerator.createChildBlock(genesis); Block uncle12 = blockGenerator...
public static Set<Keccak256> getUncles(BlockStore store, Block block, int levels) { return getUncles(store, block.getNumber(), block.getParentHash(), levels); }
FamilyUtils { public static Set<Keccak256> getUncles(BlockStore store, Block block, int levels) { return getUncles(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static Set<Keccak256> getUncles(BlockStore store, Block block, int levels) { return getUncles(store, block.getNumber(), block.getParentHash(), levels); } }
FamilyUtils { public static Set<Keccak256> getUncles(BlockStore store, Block block, int levels) { return getUncles(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockStore blockStore, ...
FamilyUtils { public static Set<Keccak256> getUncles(BlockStore store, Block block, int levels) { return getUncles(store, block.getNumber(), block.getParentHash(), levels); } static Set<Keccak256> getAncestors(BlockStore blockStore, Block block, int limitNum); static Set<Keccak256> getAncestors(BlockStore blockStore, ...
@Test public void collectsOnBlocksPerEpochModulo() { for (int i = 100; i < 105; i++) { Block block = block(i); listener.onBestBlock(block, null); } verify(multiTrieStore, never()).collect(any()); byte[] stateRoot = new byte[] {0x42, 0x43, 0x02}; withSnapshotStateRootAtBlockNumber(85, stateRoot); Block block = block(105...
private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); }
GarbageCollector implements InternalService { private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); } }
GarbageCollector implements InternalService { private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); } GarbageCollector(CompositeEthereumListener emitter, ...
GarbageCollector implements InternalService { private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); } GarbageCollector(CompositeEthereumListener emitter, ...
GarbageCollector implements InternalService { private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); } GarbageCollector(CompositeEthereumListener emitter, ...
@Test public void collectsOnBlocksPerEpochModuloAndMinimumOfStatesToKeep() { for (int i = 0; i < 21; i++) { Block block = block(i); listener.onBestBlock(block, null); } verify(multiTrieStore, never()).collect(any()); byte[] stateRoot = new byte[] {0x42, 0x43, 0x02}; withSnapshotStateRootAtBlockNumber(1, stateRoot); Blo...
private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); }
GarbageCollector implements InternalService { private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); } }
GarbageCollector implements InternalService { private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); } GarbageCollector(CompositeEthereumListener emitter, ...
GarbageCollector implements InternalService { private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); } GarbageCollector(CompositeEthereumListener emitter, ...
GarbageCollector implements InternalService { private void collect(long untilBlock) { BlockHeader untilHeader = blockStore.getChainBlockByNumber(untilBlock).getHeader(); multiTrieStore.collect(repositoryLocator.snapshotAt(untilHeader).getRoot()); } GarbageCollector(CompositeEthereumListener emitter, ...
@Test public void testEncodeLength() { int length = 1; int offset = 128; byte[] encodedLength = encodeLength(length, offset); String expected = "81"; assertEquals(expected, ByteUtil.toHexString(encodedLength)); length = 56; offset = 192; encodedLength = encodeLength(length, offset); expected = "f838"; assertEquals(expe...
public static byte[] encodeLength(int length, int offset) { if (length < SIZE_THRESHOLD) { byte firstByte = (byte) (length + offset); return new byte[]{firstByte}; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; if (length > 0xFF) { binaryLength = intToBytesNoLeadZeroes(length); } else { binaryLength = new ...
RLP { public static byte[] encodeLength(int length, int offset) { if (length < SIZE_THRESHOLD) { byte firstByte = (byte) (length + offset); return new byte[]{firstByte}; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; if (length > 0xFF) { binaryLength = intToBytesNoLeadZeroes(length); } else { binaryLength ...
RLP { public static byte[] encodeLength(int length, int offset) { if (length < SIZE_THRESHOLD) { byte firstByte = (byte) (length + offset); return new byte[]{firstByte}; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; if (length > 0xFF) { binaryLength = intToBytesNoLeadZeroes(length); } else { binaryLength ...
RLP { public static byte[] encodeLength(int length, int offset) { if (length < SIZE_THRESHOLD) { byte firstByte = (byte) (length + offset); return new byte[]{firstByte}; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; if (length > 0xFF) { binaryLength = intToBytesNoLeadZeroes(length); } else { binaryLength ...
RLP { public static byte[] encodeLength(int length, int offset) { if (length < SIZE_THRESHOLD) { byte firstByte = (byte) (length + offset); return new byte[]{firstByte}; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; if (length > 0xFF) { binaryLength = intToBytesNoLeadZeroes(length); } else { binaryLength ...
@Test public void executeBlockWithoutTransaction() { Block parent = blockchain.getBestBlock(); Block block = new BlockGenerator().createChildBlock(parent); BlockResult result = executor.execute(block, parent.getHeader(), false); Assert.assertNotNull(result); Assert.assertNotNull(result.getTransactionReceipts()); Assert...
@VisibleForTesting public BlockResult execute(Block block, BlockHeader parent, boolean discardInvalidTxs) { return execute(block, parent, discardInvalidTxs, false); }
BlockExecutor { @VisibleForTesting public BlockResult execute(Block block, BlockHeader parent, boolean discardInvalidTxs) { return execute(block, parent, discardInvalidTxs, false); } }
BlockExecutor { @VisibleForTesting public BlockResult execute(Block block, BlockHeader parent, boolean discardInvalidTxs) { return execute(block, parent, discardInvalidTxs, false); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, StateRootHandl...
BlockExecutor { @VisibleForTesting public BlockResult execute(Block block, BlockHeader parent, boolean discardInvalidTxs) { return execute(block, parent, discardInvalidTxs, false); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, StateRootHandl...
BlockExecutor { @VisibleForTesting public BlockResult execute(Block block, BlockHeader parent, boolean discardInvalidTxs) { return execute(block, parent, discardInvalidTxs, false); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, StateRootHandl...
@Test public void executeAndFillBlockWithTxToExcludeBecauseSenderHasNoBalance() { TrieStore trieStore = new TrieStoreImpl(new HashMapDB()); Repository repository = new MutableRepository(new MutableTrieImpl(trieStore, new Trie(trieStore))); Repository track = repository.startTracking(); Account account = createAccount("...
public BlockResult executeAndFill(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, true, false); fill(block, result); return result; }
BlockExecutor { public BlockResult executeAndFill(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, true, false); fill(block, result); return result; } }
BlockExecutor { public BlockResult executeAndFill(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, true, false); fill(block, result); return result; } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, StateRootHandler...
BlockExecutor { public BlockResult executeAndFill(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, true, false); fill(block, result); return result; } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, StateRootHandler...
BlockExecutor { public BlockResult executeAndFill(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, true, false); fill(block, result); return result; } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, StateRootHandler...
@Test public void executeBlockWithTxThatMakesBlockInvalidSenderHasNoBalance() { TrieStore trieStore = new TrieStoreImpl(new HashMapDB()); Repository repository = new MutableRepository(new MutableTrieImpl(trieStore, new Trie(trieStore))); Repository track = repository.startTracking(); Account account = createAccount("ac...
@VisibleForTesting public BlockResult execute(Block block, BlockHeader parent, boolean discardInvalidTxs) { return execute(block, parent, discardInvalidTxs, false); }
BlockExecutor { @VisibleForTesting public BlockResult execute(Block block, BlockHeader parent, boolean discardInvalidTxs) { return execute(block, parent, discardInvalidTxs, false); } }
BlockExecutor { @VisibleForTesting public BlockResult execute(Block block, BlockHeader parent, boolean discardInvalidTxs) { return execute(block, parent, discardInvalidTxs, false); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, StateRootHandl...
BlockExecutor { @VisibleForTesting public BlockResult execute(Block block, BlockHeader parent, boolean discardInvalidTxs) { return execute(block, parent, discardInvalidTxs, false); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, StateRootHandl...
BlockExecutor { @VisibleForTesting public BlockResult execute(Block block, BlockHeader parent, boolean discardInvalidTxs) { return execute(block, parent, discardInvalidTxs, false); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, StateRootHandl...
@Test public void validateBlock() { TestObjects objects = generateBlockWithOneTransaction(); Block parent = objects.getParent(); Block block = objects.getBlock(); BlockExecutor executor = buildBlockExecutor(objects.getTrieStore()); Assert.assertTrue(executor.executeAndValidate(block, parent.getHeader())); }
@VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
@Test public void invalidBlockBadStateRoot() { TestObjects objects = generateBlockWithOneTransaction(); Block parent = objects.getParent(); Block block = objects.getBlock(); BlockExecutor executor = buildBlockExecutor(objects.getTrieStore()); byte[] stateRoot = block.getStateRoot(); stateRoot[0] = (byte) ((stateRoot[0]...
@VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
@Test public void invalidBlockBadReceiptsRoot() { TestObjects objects = generateBlockWithOneTransaction(); Block parent = objects.getParent(); Block block = objects.getBlock(); BlockExecutor executor = buildBlockExecutor(objects.getTrieStore()); byte[] receiptsRoot = block.getReceiptsRoot(); receiptsRoot[0] = (byte) ((...
@VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
@Test public void invalidBlockBadGasUsed() { TestObjects objects = generateBlockWithOneTransaction(); Block parent = objects.getParent(); Block block = objects.getBlock(); BlockExecutor executor = buildBlockExecutor(objects.getTrieStore()); block.getHeader().setGasUsed(0); Assert.assertFalse(executor.executeAndValidate...
@VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
@Test public void invalidBlockBadPaidFees() { TestObjects objects = generateBlockWithOneTransaction(); Block parent = objects.getParent(); Block block = objects.getBlock(); BlockExecutor executor = buildBlockExecutor(objects.getTrieStore()); block.getHeader().setPaidFees(Coin.ZERO); Assert.assertFalse(executor.executeA...
@VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
@Test public void invalidBlockBadLogsBloom() { TestObjects objects = generateBlockWithOneTransaction(); Block parent = objects.getParent(); Block block = objects.getBlock(); BlockExecutor executor = buildBlockExecutor(objects.getTrieStore()); byte[] logBloom = block.getLogBloom(); logBloom[0] = (byte) ((logBloom[0] + 1...
@VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } }
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
BlockExecutor { @VisibleForTesting public boolean executeAndValidate(Block block, BlockHeader parent) { BlockResult result = execute(block, parent, false, false); return this.validate(block, result); } BlockExecutor( ActivationConfig activationConfig, RepositoryLocator repositoryLocator, ...
@Test public void calculateReceiptsTrieRootForOK() { World world = new World(); Account acc1 = new AccountBuilder(world).name("acc1").balance(Coin.valueOf(2000000)).build(); Account acc2 = new AccountBuilder().name("acc2").build(); Transaction tx1 = new TransactionBuilder().sender(acc1).receiver(acc2).value(BigInteger....
public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; }
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } }
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } private BlockHashesHelper(); }
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } private BlockHashesHelper(); sta...
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } private BlockHashesHelper(); sta...
@Test @Ignore public void unsupportedLength() { int length = 56; int offset = 192; byte[] encodedLength; double maxLength = Math.pow(256, 8); try { encodedLength = encodeLength((int) maxLength, offset); System.out.println("length: " + length + ", offset: " + offset + ", encoded: " + Arrays.toString(encodedLength)); fai...
public static byte[] encodeLength(int length, int offset) { if (length < SIZE_THRESHOLD) { byte firstByte = (byte) (length + offset); return new byte[]{firstByte}; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; if (length > 0xFF) { binaryLength = intToBytesNoLeadZeroes(length); } else { binaryLength = new ...
RLP { public static byte[] encodeLength(int length, int offset) { if (length < SIZE_THRESHOLD) { byte firstByte = (byte) (length + offset); return new byte[]{firstByte}; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; if (length > 0xFF) { binaryLength = intToBytesNoLeadZeroes(length); } else { binaryLength ...
RLP { public static byte[] encodeLength(int length, int offset) { if (length < SIZE_THRESHOLD) { byte firstByte = (byte) (length + offset); return new byte[]{firstByte}; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; if (length > 0xFF) { binaryLength = intToBytesNoLeadZeroes(length); } else { binaryLength ...
RLP { public static byte[] encodeLength(int length, int offset) { if (length < SIZE_THRESHOLD) { byte firstByte = (byte) (length + offset); return new byte[]{firstByte}; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; if (length > 0xFF) { binaryLength = intToBytesNoLeadZeroes(length); } else { binaryLength ...
RLP { public static byte[] encodeLength(int length, int offset) { if (length < SIZE_THRESHOLD) { byte firstByte = (byte) (length + offset); return new byte[]{firstByte}; } else if (length < MAX_ITEM_LENGTH) { byte[] binaryLength; if (length > 0xFF) { binaryLength = intToBytesNoLeadZeroes(length); } else { binaryLength ...
@Test(expected = BlockHashesHelperException.class) public void calculateReceiptsTrieRootForException() { World world = new World(); Account acc1 = new AccountBuilder(world).name("acc1").balance(Coin.valueOf(2000000)).build(); Account acc2 = new AccountBuilder().name("acc2").build(); Transaction tx = new TransactionBuil...
public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; }
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } }
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } private BlockHashesHelper(); }
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } private BlockHashesHelper(); sta...
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } private BlockHashesHelper(); sta...
@Test public void calculateReceiptsTrieRootForDifferentTxHash() { World world = new World(); Account acc1 = new AccountBuilder(world).name("acc1").balance(Coin.valueOf(2000000)).build(); Account acc2 = new AccountBuilder().name("acc2").build(); Transaction tx1 = new TransactionBuilder().sender(acc1).receiver(acc2).valu...
public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; }
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } }
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } private BlockHashesHelper(); }
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } private BlockHashesHelper(); sta...
BlockHashesHelper { public static Trie calculateReceiptsTrieRootFor(List<TransactionReceipt> receipts) { Trie receiptsTrie = new Trie(); for (int i = 0; i < receipts.size(); i++) { receiptsTrie = receiptsTrie.put(RLP.encodeInt(i), receipts.get(i).getEncoded()); } return receiptsTrie; } private BlockHashesHelper(); sta...
@Test public void onBestBlockTest() { Block genesis = blockChain.getBestBlock(); BlockGenerator blockGenerator = new BlockGenerator(); Block block1 = blockGenerator.createChildBlock(genesis,0,2l); Block block1b = blockGenerator.createChildBlock(genesis,0,1l); Assert.assertEquals(ImportResult.IMPORTED_BEST, blockChain.t...
private void onBestBlock(Block block, BlockResult result) { if (result != null && listener != null){ listener.onBestBlock(block, result.getTransactionReceipts()); } }
BlockChainImpl implements Blockchain { private void onBestBlock(Block block, BlockResult result) { if (result != null && listener != null){ listener.onBestBlock(block, result.getTransactionReceipts()); } } }
BlockChainImpl implements Blockchain { private void onBestBlock(Block block, BlockResult result) { if (result != null && listener != null){ listener.onBestBlock(block, result.getTransactionReceipts()); } } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, ...
BlockChainImpl implements Blockchain { private void onBestBlock(Block block, BlockResult result) { if (result != null && listener != null){ listener.onBestBlock(block, result.getTransactionReceipts()); } } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, ...
BlockChainImpl implements Blockchain { private void onBestBlock(Block block, BlockResult result) { if (result != null && listener != null){ listener.onBestBlock(block, result.getTransactionReceipts()); } } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, ...
@Test public void nullBlockAsInvalidBlock() { Assert.assertEquals(ImportResult.INVALID_BLOCK, blockChain.tryToConnect(null)); }
@Override public ImportResult tryToConnect(Block block) { this.lock.readLock().lock(); try { if (block == null) { return ImportResult.INVALID_BLOCK; } if (!block.isSealed()) { panicProcessor.panic("unsealedblock", String.format("Unsealed block %s %s", block.getNumber(), block.getHash())); block.seal(); } try { org.slf4...
BlockChainImpl implements Blockchain { @Override public ImportResult tryToConnect(Block block) { this.lock.readLock().lock(); try { if (block == null) { return ImportResult.INVALID_BLOCK; } if (!block.isSealed()) { panicProcessor.panic("unsealedblock", String.format("Unsealed block %s %s", block.getNumber(), block.getH...
BlockChainImpl implements Blockchain { @Override public ImportResult tryToConnect(Block block) { this.lock.readLock().lock(); try { if (block == null) { return ImportResult.INVALID_BLOCK; } if (!block.isSealed()) { panicProcessor.panic("unsealedblock", String.format("Unsealed block %s %s", block.getNumber(), block.getH...
BlockChainImpl implements Blockchain { @Override public ImportResult tryToConnect(Block block) { this.lock.readLock().lock(); try { if (block == null) { return ImportResult.INVALID_BLOCK; } if (!block.isSealed()) { panicProcessor.panic("unsealedblock", String.format("Unsealed block %s %s", block.getNumber(), block.getH...
BlockChainImpl implements Blockchain { @Override public ImportResult tryToConnect(Block block) { this.lock.readLock().lock(); try { if (block == null) { return ImportResult.INVALID_BLOCK; } if (!block.isSealed()) { panicProcessor.panic("unsealedblock", String.format("Unsealed block %s %s", block.getNumber(), block.getH...
@Test public void getBlocksByNumber() { Block genesis = blockChain.getBestBlock(); BlockGenerator blockGenerator = new BlockGenerator(); Block block1 = blockGenerator.createChildBlock(genesis,0,2); Block block1b = blockGenerator.createChildBlock(genesis,0,1); Assert.assertEquals(ImportResult.IMPORTED_BEST, blockChain.t...
@Override public List<Block> getBlocksByNumber(long number) { return blockStore.getChainBlocksByNumber(number); }
BlockChainImpl implements Blockchain { @Override public List<Block> getBlocksByNumber(long number) { return blockStore.getChainBlocksByNumber(number); } }
BlockChainImpl implements Blockchain { @Override public List<Block> getBlocksByNumber(long number) { return blockStore.getChainBlocksByNumber(number); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, ...
BlockChainImpl implements Blockchain { @Override public List<Block> getBlocksByNumber(long number) { return blockStore.getChainBlocksByNumber(number); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, ...
BlockChainImpl implements Blockchain { @Override public List<Block> getBlocksByNumber(long number) { return blockStore.getChainBlocksByNumber(number); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, ...
@Test public void getBlockByNumber() { Block genesis = blockChain.getBestBlock(); BlockGenerator blockGenerator = new BlockGenerator(); Block block1 = blockGenerator.createChildBlock(genesis); Block block2 = blockGenerator.createChildBlock(block1); Block block3 = blockGenerator.createChildBlock(block2); Assert.assertEq...
@Override public Block getBlockByNumber(long number) { return blockStore.getChainBlockByNumber(number); }
BlockChainImpl implements Blockchain { @Override public Block getBlockByNumber(long number) { return blockStore.getChainBlockByNumber(number); } }
BlockChainImpl implements Blockchain { @Override public Block getBlockByNumber(long number) { return blockStore.getChainBlockByNumber(number); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, ...
BlockChainImpl implements Blockchain { @Override public Block getBlockByNumber(long number) { return blockStore.getChainBlockByNumber(number); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, ...
BlockChainImpl implements Blockchain { @Override public Block getBlockByNumber(long number) { return blockStore.getChainBlockByNumber(number); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, ...
@Test public void switchToOtherChainInvalidBadBlockBadReceiptsRoot() { Block genesis = blockChain.getBestBlock(); BlockGenerator blockGenerator = new BlockGenerator(); Block block1 = blockGenerator.createChildBlock(genesis); Block block1b = blockGenerator.createChildBlock(genesis); if (FastByteComparisons.compareTo(blo...
@Override public Block getBestBlock() { return this.status.getBestBlock(); }
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } }
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumListener listener, ...
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumListener listener, ...
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumListener listener, ...
@Test public void getUnknownBlockByHash() { Assert.assertNull(blockChain.getBlockByHash(new BlockGenerator().getBlock(1).getHash().getBytes())); }
@Override public Block getBlockByHash(byte[] hash) { return blockStore.getBlockByHash(hash); }
BlockChainImpl implements Blockchain { @Override public Block getBlockByHash(byte[] hash) { return blockStore.getBlockByHash(hash); } }
BlockChainImpl implements Blockchain { @Override public Block getBlockByHash(byte[] hash) { return blockStore.getBlockByHash(hash); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumLi...
BlockChainImpl implements Blockchain { @Override public Block getBlockByHash(byte[] hash) { return blockStore.getBlockByHash(hash); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumLi...
BlockChainImpl implements Blockchain { @Override public Block getBlockByHash(byte[] hash) { return blockStore.getBlockByHash(hash); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumLi...
@Test public void validateMinedBlockOne() { Block genesis = blockChain.getBestBlock(); Block block = new BlockGenerator().createChildBlock(genesis); Assert.assertTrue(blockExecutor.executeAndValidate(block, genesis.getHeader())); }
@Override public Block getBestBlock() { return this.status.getBestBlock(); }
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } }
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumListener listener, ...
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumListener listener, ...
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumListener listener, ...
@Test public void validateMinedBlockSeven() { Block genesis = blockChain.getBestBlock(); BlockGenerator blockGenerator = new BlockGenerator(); Block block1 = blockGenerator.createChildBlock(genesis); Block block2 = blockGenerator.createChildBlock(block1); Block block3 = blockGenerator.createChildBlock(block2); Block bl...
@Override public Block getBestBlock() { return this.status.getBestBlock(); }
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } }
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumListener listener, ...
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumListener listener, ...
BlockChainImpl implements Blockchain { @Override public Block getBestBlock() { return this.status.getBestBlock(); } BlockChainImpl(BlockStore blockStore, ReceiptStore receiptStore, TransactionPool transactionPool, EthereumListener listener, ...
@Test public void encodeEdgeShortList() { String expectedOutput = "f7c0c0b4600160003556601359506301000000600035040f6018590060005660805460016080530160005760003560805760203560003557"; byte[] rlpKeysList = Hex.decode("c0"); byte[] rlpValuesList = Hex.decode("c0"); byte[] rlpCode = Hex.decode("b4600160003556601359506301000...
public static byte[] encodeList(byte[]... elements) { if (elements == null) { return new byte[]{(byte) OFFSET_SHORT_LIST}; } int totalLength = 0; for (byte[] element1 : elements) { totalLength += element1.length; } byte[] data; int copyPos; if (totalLength < SIZE_THRESHOLD) { data = new byte[1 + totalLength]; data[0] =...
RLP { public static byte[] encodeList(byte[]... elements) { if (elements == null) { return new byte[]{(byte) OFFSET_SHORT_LIST}; } int totalLength = 0; for (byte[] element1 : elements) { totalLength += element1.length; } byte[] data; int copyPos; if (totalLength < SIZE_THRESHOLD) { data = new byte[1 + totalLength]; dat...
RLP { public static byte[] encodeList(byte[]... elements) { if (elements == null) { return new byte[]{(byte) OFFSET_SHORT_LIST}; } int totalLength = 0; for (byte[] element1 : elements) { totalLength += element1.length; } byte[] data; int copyPos; if (totalLength < SIZE_THRESHOLD) { data = new byte[1 + totalLength]; dat...
RLP { public static byte[] encodeList(byte[]... elements) { if (elements == null) { return new byte[]{(byte) OFFSET_SHORT_LIST}; } int totalLength = 0; for (byte[] element1 : elements) { totalLength += element1.length; } byte[] data; int copyPos; if (totalLength < SIZE_THRESHOLD) { data = new byte[1 + totalLength]; dat...
RLP { public static byte[] encodeList(byte[]... elements) { if (elements == null) { return new byte[]{(byte) OFFSET_SHORT_LIST}; } int totalLength = 0; for (byte[] element1 : elements) { totalLength += element1.length; } byte[] data; int copyPos; if (totalLength < SIZE_THRESHOLD) { data = new byte[1 + totalLength]; dat...
@Test public void getUnknownTransactionInfoAsNull() { Assert.assertNull(blockChain.getTransactionInfo(new byte[] { 0x01 })); }
@Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.setTransaction(tx); return txInfo; }
BlockChainImpl implements Blockchain { @Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.setTransaction(...
BlockChainImpl implements Blockchain { @Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.setTransaction(...
BlockChainImpl implements Blockchain { @Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.setTransaction(...
BlockChainImpl implements Blockchain { @Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.setTransaction(...
@Test public void getTransactionInfo() { Block block = getBlockWithOneTransaction(); Assert.assertEquals(ImportResult.IMPORTED_BEST, blockChain.tryToConnect(block)); Transaction tx = block.getTransactionsList().get(0); Assert.assertNotNull(blockChain.getTransactionInfo(tx.getHash().getBytes())); }
@Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.setTransaction(tx); return txInfo; }
BlockChainImpl implements Blockchain { @Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.setTransaction(...
BlockChainImpl implements Blockchain { @Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.setTransaction(...
BlockChainImpl implements Blockchain { @Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.setTransaction(...
BlockChainImpl implements Blockchain { @Override public TransactionInfo getTransactionInfo(byte[] hash) { TransactionInfo txInfo = receiptStore.get(hash); if (txInfo == null) { return null; } Transaction tx = this.getBlockByHash(txInfo.getBlockHash()).getTransactionsList().get(txInfo.getIndex()); txInfo.setTransaction(...
@Test public void blockInSomeBlockChain() { BlockChainBuilder blockChainBuilder = new BlockChainBuilder(); BlockChainImpl blockChain = blockChainBuilder.build(); org.ethereum.db.BlockStore blockStore = blockChainBuilder.getBlockStore(); Block genesis = blockChain.getBestBlock(); Block block1 = new BlockBuilder(null, nu...
public static boolean blockInSomeBlockChain(Block block, Blockchain blockChain) { return blockInSomeBlockChain(block.getHash(), block.getNumber(), blockChain); }
BlockUtils { public static boolean blockInSomeBlockChain(Block block, Blockchain blockChain) { return blockInSomeBlockChain(block.getHash(), block.getNumber(), blockChain); } }
BlockUtils { public static boolean blockInSomeBlockChain(Block block, Blockchain blockChain) { return blockInSomeBlockChain(block.getHash(), block.getNumber(), blockChain); } private BlockUtils(); }
BlockUtils { public static boolean blockInSomeBlockChain(Block block, Blockchain blockChain) { return blockInSomeBlockChain(block.getHash(), block.getNumber(), blockChain); } private BlockUtils(); static boolean tooMuchProcessTime(long nanoseconds); static boolean blockInSomeBlockChain(Block block, Blockchain blockCha...
BlockUtils { public static boolean blockInSomeBlockChain(Block block, Blockchain blockChain) { return blockInSomeBlockChain(block.getHash(), block.getNumber(), blockChain); } private BlockUtils(); static boolean tooMuchProcessTime(long nanoseconds); static boolean blockInSomeBlockChain(Block block, Blockchain blockCha...
@Test public void unknowAncestorsHashes() { BlockChainImpl blockChain = new BlockChainBuilder().build(); NetBlockStore store = new NetBlockStore(); Block genesis = blockChain.getBestBlock(); Block block1 = new BlockBuilder(null, null, null).difficulty(2l).parent(genesis).build(); Block block1b = new BlockBuilder(null, ...
public static Set<Keccak256> unknownAncestorsHashes(Keccak256 blockHash, Blockchain blockChain, NetBlockStore store) { Set<Keccak256> hashes = Collections.singleton(blockHash); return unknownAncestorsHashes(hashes, blockChain, store, true); }
BlockUtils { public static Set<Keccak256> unknownAncestorsHashes(Keccak256 blockHash, Blockchain blockChain, NetBlockStore store) { Set<Keccak256> hashes = Collections.singleton(blockHash); return unknownAncestorsHashes(hashes, blockChain, store, true); } }
BlockUtils { public static Set<Keccak256> unknownAncestorsHashes(Keccak256 blockHash, Blockchain blockChain, NetBlockStore store) { Set<Keccak256> hashes = Collections.singleton(blockHash); return unknownAncestorsHashes(hashes, blockChain, store, true); } private BlockUtils(); }
BlockUtils { public static Set<Keccak256> unknownAncestorsHashes(Keccak256 blockHash, Blockchain blockChain, NetBlockStore store) { Set<Keccak256> hashes = Collections.singleton(blockHash); return unknownAncestorsHashes(hashes, blockChain, store, true); } private BlockUtils(); static boolean tooMuchProcessTime(long na...
BlockUtils { public static Set<Keccak256> unknownAncestorsHashes(Keccak256 blockHash, Blockchain blockChain, NetBlockStore store) { Set<Keccak256> hashes = Collections.singleton(blockHash); return unknownAncestorsHashes(hashes, blockChain, store, true); } private BlockUtils(); static boolean tooMuchProcessTime(long na...
@Test public void unknowAncestorsHashesUsingUncles() { BlockChainBuilder blockChainBuilder = new BlockChainBuilder(); BlockChainImpl blockChain = blockChainBuilder.build(); Genesis genesis = (Genesis) blockChain.getBestBlock(); NetBlockStore store = new NetBlockStore(); BlockBuilder blockBuilder = new BlockBuilder(bloc...
public static Set<Keccak256> unknownAncestorsHashes(Keccak256 blockHash, Blockchain blockChain, NetBlockStore store) { Set<Keccak256> hashes = Collections.singleton(blockHash); return unknownAncestorsHashes(hashes, blockChain, store, true); }
BlockUtils { public static Set<Keccak256> unknownAncestorsHashes(Keccak256 blockHash, Blockchain blockChain, NetBlockStore store) { Set<Keccak256> hashes = Collections.singleton(blockHash); return unknownAncestorsHashes(hashes, blockChain, store, true); } }
BlockUtils { public static Set<Keccak256> unknownAncestorsHashes(Keccak256 blockHash, Blockchain blockChain, NetBlockStore store) { Set<Keccak256> hashes = Collections.singleton(blockHash); return unknownAncestorsHashes(hashes, blockChain, store, true); } private BlockUtils(); }
BlockUtils { public static Set<Keccak256> unknownAncestorsHashes(Keccak256 blockHash, Blockchain blockChain, NetBlockStore store) { Set<Keccak256> hashes = Collections.singleton(blockHash); return unknownAncestorsHashes(hashes, blockChain, store, true); } private BlockUtils(); static boolean tooMuchProcessTime(long na...
BlockUtils { public static Set<Keccak256> unknownAncestorsHashes(Keccak256 blockHash, Blockchain blockChain, NetBlockStore store) { Set<Keccak256> hashes = Collections.singleton(blockHash); return unknownAncestorsHashes(hashes, blockChain, store, true); } private BlockUtils(); static boolean tooMuchProcessTime(long na...
@Test public void tooMuchProcessTime() { Assert.assertFalse(BlockUtils.tooMuchProcessTime(0)); Assert.assertFalse(BlockUtils.tooMuchProcessTime(1000)); Assert.assertFalse(BlockUtils.tooMuchProcessTime(1_000_000L)); Assert.assertFalse(BlockUtils.tooMuchProcessTime(1_000_000_000L)); Assert.assertFalse(BlockUtils.tooMuchP...
public static boolean tooMuchProcessTime(long nanoseconds) { return nanoseconds > MAX_BLOCK_PROCESS_TIME_NANOSECONDS; }
BlockUtils { public static boolean tooMuchProcessTime(long nanoseconds) { return nanoseconds > MAX_BLOCK_PROCESS_TIME_NANOSECONDS; } }
BlockUtils { public static boolean tooMuchProcessTime(long nanoseconds) { return nanoseconds > MAX_BLOCK_PROCESS_TIME_NANOSECONDS; } private BlockUtils(); }
BlockUtils { public static boolean tooMuchProcessTime(long nanoseconds) { return nanoseconds > MAX_BLOCK_PROCESS_TIME_NANOSECONDS; } private BlockUtils(); static boolean tooMuchProcessTime(long nanoseconds); static boolean blockInSomeBlockChain(Block block, Blockchain blockChain); static Set<Keccak256> unknownDirectAn...
BlockUtils { public static boolean tooMuchProcessTime(long nanoseconds) { return nanoseconds > MAX_BLOCK_PROCESS_TIME_NANOSECONDS; } private BlockUtils(); static boolean tooMuchProcessTime(long nanoseconds); static boolean blockInSomeBlockChain(Block block, Blockchain blockChain); static Set<Keccak256> unknownDirectAn...
@Test public void usingAccountsWithInitialBalance() { createTestAccounts(2, Coin.valueOf(10L)); PendingState pendingState = transactionPool.getPendingState(); Assert.assertNotNull(pendingState); Account account1 = createAccount(1); Account account2 = createAccount(2); Assert.assertEquals(BigInteger.TEN, pendingState.ge...
@Override public PendingState getPendingState() { return getPendingState(getCurrentRepository()); }
TransactionPoolImpl implements TransactionPool { @Override public PendingState getPendingState() { return getPendingState(getCurrentRepository()); } }
TransactionPoolImpl implements TransactionPool { @Override public PendingState getPendingState() { return getPendingState(getCurrentRepository()); } TransactionPoolImpl( RskSystemProperties config, RepositoryLocator repositoryLocator, BlockStore blockStore, BlockFactory b...
TransactionPoolImpl implements TransactionPool { @Override public PendingState getPendingState() { return getPendingState(getCurrentRepository()); } TransactionPoolImpl( RskSystemProperties config, RepositoryLocator repositoryLocator, BlockStore blockStore, BlockFactory b...
TransactionPoolImpl implements TransactionPool { @Override public PendingState getPendingState() { return getPendingState(getCurrentRepository()); } TransactionPoolImpl( RskSystemProperties config, RepositoryLocator repositoryLocator, BlockStore blockStore, BlockFactory b...
@Test public void getEmptyPendingTransactionList() { List<Transaction> transactions = transactionPool.getPendingTransactions(); Assert.assertNotNull(transactions); Assert.assertTrue(transactions.isEmpty()); }
@Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); }
TransactionPoolImpl implements TransactionPool { @Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); } }
TransactionPoolImpl implements TransactionPool { @Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); } TransactionPoolImpl( RskSystemPr...
TransactionPoolImpl implements TransactionPool { @Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); } TransactionPoolImpl( RskSystemPr...
TransactionPoolImpl implements TransactionPool { @Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); } TransactionPoolImpl( RskSystemPr...
@Test public void getEmptyTransactionList() { List<Transaction> transactions = transactionPool.getPendingTransactions(); Assert.assertNotNull(transactions); Assert.assertTrue(transactions.isEmpty()); }
@Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); }
TransactionPoolImpl implements TransactionPool { @Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); } }
TransactionPoolImpl implements TransactionPool { @Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); } TransactionPoolImpl( RskSystemPr...
TransactionPoolImpl implements TransactionPool { @Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); } TransactionPoolImpl( RskSystemPr...
TransactionPoolImpl implements TransactionPool { @Override public synchronized List<Transaction> getPendingTransactions() { removeObsoleteTransactions(this.outdatedThreshold, this.outdatedTimeout); return Collections.unmodifiableList(pendingTransactions.getTransactions()); } TransactionPoolImpl( RskSystemPr...
@Test public void checkTxWithSameNonceIsRejected() { Coin balance = Coin.valueOf(1000000); createTestAccounts(2, balance); Transaction tx = createSampleTransaction(1, 0, 1000, 0); Transaction tx2 = createSampleTransaction(1, 0, 2000, 0); transactionPool.addTransaction(tx); TransactionPoolAddResult result = transactionP...
@Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAdded()) { return internalResult; } else if(interna...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
@Test public void encodeBigIntegerEdge_1() { BigInteger integer = new BigInteger("80", 10); byte[] encodedData = encodeBigInteger(integer); System.out.println(ByteUtil.toHexString(encodedData)); }
public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } }
RLP { public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } } }
RLP { public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } } }
RLP { public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } } static int decodeInt(byte[] data, int index); static BigInteger decodeBigInteger(byte[] data, int inde...
RLP { public static byte[] encodeBigInteger(BigInteger srcBigInteger) { if (srcBigInteger.equals(BigInteger.ZERO)) { return encodeByte((byte) 0); } else { return encodeElement(asUnsignedByteArray(srcBigInteger)); } } static int decodeInt(byte[] data, int index); static BigInteger decodeBigInteger(byte[] data, int inde...
@Test public void checkRemascTxIsRejected() { RemascTransaction tx = new RemascTransaction(10); TransactionPoolAddResult result = transactionPool.addTransaction(tx); Assert.assertFalse(result.transactionsWereAdded()); Assert.assertEquals("transaction is a remasc transaction", result.getErrorMessage()); }
@Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAdded()) { return internalResult; } else if(interna...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
@Test public void aNewTxIsAddedInTxPoolAndShouldBeAddedInCache(){ Coin balance = Coin.valueOf(1000000); createTestAccounts(2, balance); Account account1 = createAccount(1); Transaction tx = createSampleTransaction(1, 2, 1000, 0); transactionPool.addTransaction(tx); Assert.assertTrue(signatureCache.containsTx(tx)); Asse...
@Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAdded()) { return internalResult; } else if(interna...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
@Test public void twoTxsAreAddedInTxPoolAndShouldBeAddedInCache(){ Coin balance = Coin.valueOf(1000000); Account account1 = createAccount(1); createTestAccounts(2, balance); Transaction tx1 = createSampleTransaction(1, 2, 1000, 0); Transaction tx2 = createSampleTransaction(1, 2, 1000, 1); transactionPool.addTransaction...
@Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAdded()) { return internalResult; } else if(interna...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
@Test public void invalidTxsIsSentAndShouldntBeInCache(){ Coin balance = Coin.valueOf(0); createTestAccounts(2, balance); Transaction tx1 = createSampleTransaction(1, 2, 1000, 1); transactionPool.addTransaction(tx1); Assert.assertFalse(signatureCache.containsTx(tx1)); }
@Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAdded()) { return internalResult; } else if(interna...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
@Test public void remascTxIsReceivedAndShouldntBeInCache() { RemascTransaction tx = new RemascTransaction(10); transactionPool.addTransaction(tx); Assert.assertFalse(signatureCache.containsTx(tx)); verify(signatureCache, times(0)).storeSender(tx); signatureCache.storeSender(tx); Assert.assertFalse(signatureCache.contai...
@Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAdded()) { return internalResult; } else if(interna...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
@Test public void firstTxIsRemovedWhenTheCacheLimitSizeIsExceeded() { Coin balance = Coin.valueOf(1000000); createTestAccounts(6005, balance); Transaction tx = createSampleTransaction(1, 2, 1, 0); transactionPool.addTransaction(tx); for (int i = 0; i < MAX_CACHE_SIZE; i++) { if (i == MAX_CACHE_SIZE - 1) { Assert.assert...
@Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAdded()) { return internalResult; } else if(interna...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
TransactionPoolImpl implements TransactionPool { @Override public synchronized TransactionPoolAddResult addTransaction(final Transaction tx) { TransactionPoolAddResult internalResult = this.internalAddTransaction(tx); List<Transaction> pendingTransactionsAdded = new ArrayList<>(); if (!internalResult.transactionsWereAd...
@Test public void smallerBlockHashTest() { byte[] lowerHash = new byte[]{0}; byte[] biggerHash = new byte[]{1}; assertTrue(SelectionRule.isThisBlockHashSmaller(lowerHash, biggerHash)); assertFalse(SelectionRule.isThisBlockHashSmaller(biggerHash, lowerHash)); }
public static boolean isThisBlockHashSmaller(byte[] thisBlockHash, byte[] compareBlockHash) { return FastByteComparisons.compareTo( thisBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH, compareBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH) < 0; }
SelectionRule { public static boolean isThisBlockHashSmaller(byte[] thisBlockHash, byte[] compareBlockHash) { return FastByteComparisons.compareTo( thisBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH, compareBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH) < 0; } }
SelectionRule { public static boolean isThisBlockHashSmaller(byte[] thisBlockHash, byte[] compareBlockHash) { return FastByteComparisons.compareTo( thisBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH, compareBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH) < 0; } }
SelectionRule { public static boolean isThisBlockHashSmaller(byte[] thisBlockHash, byte[] compareBlockHash) { return FastByteComparisons.compareTo( thisBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH, compareBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH) < 0; } static boolean shouldWeAddThisBlock( BlockD...
SelectionRule { public static boolean isThisBlockHashSmaller(byte[] thisBlockHash, byte[] compareBlockHash) { return FastByteComparisons.compareTo( thisBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH, compareBlockHash, BYTE_ARRAY_OFFSET, BYTE_ARRAY_LENGTH) < 0; } static boolean shouldWeAddThisBlock( BlockD...
@Test public void addBlockTest() { Blockchain blockchain = createBlockchain(); BlockGenerator blockGenerator = new BlockGenerator(); Block lowDifficultyBlock = blockGenerator.createChildBlock(blockchain.getBestBlock(), 0, 1); Block highDifficultyBlock = blockGenerator.createChildBlock(lowDifficultyBlock, 0, 5); Block h...
public static boolean shouldWeAddThisBlock( BlockDifficulty blockDifficulty, BlockDifficulty currentDifficulty, Block block, Block currentBlock) { int compareDifficulties = blockDifficulty.compareTo(currentDifficulty); if (compareDifficulties > 0) { return true; } if (compareDifficulties < 0) { return false; } Coin pfm...
SelectionRule { public static boolean shouldWeAddThisBlock( BlockDifficulty blockDifficulty, BlockDifficulty currentDifficulty, Block block, Block currentBlock) { int compareDifficulties = blockDifficulty.compareTo(currentDifficulty); if (compareDifficulties > 0) { return true; } if (compareDifficulties < 0) { return f...
SelectionRule { public static boolean shouldWeAddThisBlock( BlockDifficulty blockDifficulty, BlockDifficulty currentDifficulty, Block block, Block currentBlock) { int compareDifficulties = blockDifficulty.compareTo(currentDifficulty); if (compareDifficulties > 0) { return true; } if (compareDifficulties < 0) { return f...
SelectionRule { public static boolean shouldWeAddThisBlock( BlockDifficulty blockDifficulty, BlockDifficulty currentDifficulty, Block block, Block currentBlock) { int compareDifficulties = blockDifficulty.compareTo(currentDifficulty); if (compareDifficulties > 0) { return true; } if (compareDifficulties < 0) { return f...
SelectionRule { public static boolean shouldWeAddThisBlock( BlockDifficulty blockDifficulty, BlockDifficulty currentDifficulty, Block block, Block currentBlock) { int compareDifficulties = blockDifficulty.compareTo(currentDifficulty); if (compareDifficulties > 0) { return true; } if (compareDifficulties < 0) { return f...
@Test public void flushesAfterNInvocations() { for (int i = 0; i < 6; i++) { listener.onBestBlock(null, null); } verify(trieStore, never()).flush(); verify(blockStore, never()).flush(); verify(receiptStore, never()).flush(); listener.onBestBlock(null, null); verify(trieStore).flush(); verify(blockStore).flush(); verify...
private void flush() { if (nFlush == 0) { flushAll(); } nFlush++; nFlush = nFlush % flushNumberOfBlocks; }
BlockChainFlusher implements InternalService { private void flush() { if (nFlush == 0) { flushAll(); } nFlush++; nFlush = nFlush % flushNumberOfBlocks; } }
BlockChainFlusher implements InternalService { private void flush() { if (nFlush == 0) { flushAll(); } nFlush++; nFlush = nFlush % flushNumberOfBlocks; } BlockChainFlusher( int flushNumberOfBlocks, CompositeEthereumListener emitter, TrieStore trieStore, BlockStore blockSt...
BlockChainFlusher implements InternalService { private void flush() { if (nFlush == 0) { flushAll(); } nFlush++; nFlush = nFlush % flushNumberOfBlocks; } BlockChainFlusher( int flushNumberOfBlocks, CompositeEthereumListener emitter, TrieStore trieStore, BlockStore blockSt...
BlockChainFlusher implements InternalService { private void flush() { if (nFlush == 0) { flushAll(); } nFlush++; nFlush = nFlush % flushNumberOfBlocks; } BlockChainFlusher( int flushNumberOfBlocks, CompositeEthereumListener emitter, TrieStore trieStore, BlockStore blockSt...
@Test public void creationIsCorrect() { BlockStore blockStore = createBlockStore(3); MiningMainchainViewImpl testBlockchain = new MiningMainchainViewImpl( blockStore, 448); List<BlockHeader> result = testBlockchain.get(); assertNotNull(result); Block bestBlock = blockStore.getBestBlock(); assertThat(result.get(0).getNu...
@Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
@Test public void testEncodeListHeader(){ byte[] header = encodeListHeader(10); String expected_1 = "ca"; assertEquals(expected_1, ByteUtil.toHexString(header)); header = encodeListHeader(1000); String expected_2 = "f903e8"; assertEquals(expected_2, ByteUtil.toHexString(header)); header = encodeListHeader(1000000000); ...
public static byte[] encodeListHeader(int size) { if (size == 0) { return new byte[]{(byte) OFFSET_SHORT_LIST}; } int totalLength = size; byte[] header; if (totalLength < SIZE_THRESHOLD) { header = new byte[1]; header[0] = (byte) (OFFSET_SHORT_LIST + totalLength); } else { int tmpLength = totalLength; byte byteNum = 0;...
RLP { public static byte[] encodeListHeader(int size) { if (size == 0) { return new byte[]{(byte) OFFSET_SHORT_LIST}; } int totalLength = size; byte[] header; if (totalLength < SIZE_THRESHOLD) { header = new byte[1]; header[0] = (byte) (OFFSET_SHORT_LIST + totalLength); } else { int tmpLength = totalLength; byte byteNu...
RLP { public static byte[] encodeListHeader(int size) { if (size == 0) { return new byte[]{(byte) OFFSET_SHORT_LIST}; } int totalLength = size; byte[] header; if (totalLength < SIZE_THRESHOLD) { header = new byte[1]; header[0] = (byte) (OFFSET_SHORT_LIST + totalLength); } else { int tmpLength = totalLength; byte byteNu...
RLP { public static byte[] encodeListHeader(int size) { if (size == 0) { return new byte[]{(byte) OFFSET_SHORT_LIST}; } int totalLength = size; byte[] header; if (totalLength < SIZE_THRESHOLD) { header = new byte[1]; header[0] = (byte) (OFFSET_SHORT_LIST + totalLength); } else { int tmpLength = totalLength; byte byteNu...
RLP { public static byte[] encodeListHeader(int size) { if (size == 0) { return new byte[]{(byte) OFFSET_SHORT_LIST}; } int totalLength = size; byte[] header; if (totalLength < SIZE_THRESHOLD) { header = new byte[1]; header[0] = (byte) (OFFSET_SHORT_LIST + totalLength); } else { int tmpLength = totalLength; byte byteNu...
@Test public void createWithLessBlocksThanMaxHeight() { MiningMainchainViewImpl testBlockchain = new MiningMainchainViewImpl( createBlockStore(10), 11); List<BlockHeader> result = testBlockchain.get(); assertNotNull(result); assertThat(result.size(), is(10)); }
@Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
@Test public void createWithBlocksEqualToMaxHeight() { MiningMainchainViewImpl testBlockchain = new MiningMainchainViewImpl( createBlockStore(4), 4); List<BlockHeader> result = testBlockchain.get(); assertNotNull(result); assertThat(result.size(), is(4)); }
@Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
@Test public void createWithMoreBlocksThanMaxHeight() { MiningMainchainViewImpl testBlockchain = new MiningMainchainViewImpl( createBlockStore(8), 6); List<BlockHeader> result = testBlockchain.get(); assertNotNull(result); assertThat(result.size(), is(6)); }
@Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
@Test public void createWithOnlyGenesisAndHeightOne() { BlockStore blockStore = createBlockStore(1); Block genesis = blockStore.getChainBlockByNumber(0L); when(blockStore.getBestBlock()).thenReturn(genesis); MiningMainchainViewImpl testBlockchain = new MiningMainchainViewImpl( blockStore, 1); List<BlockHeader> result =...
@Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
@Test public void createWithOnlyGenesisAndHeightGreaterThanOne() { BlockStore blockStore = createBlockStore(1); Block genesis = blockStore.getChainBlockByNumber(0L); when(blockStore.getBestBlock()).thenReturn(genesis); MiningMainchainViewImpl testBlockchain = new MiningMainchainViewImpl( blockStore, 10); List<BlockHead...
@Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); }
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
MiningMainchainViewImpl implements MiningMainchainView { @Override public List<BlockHeader> get() { synchronized (internalBlockStoreReadWriteLock) { return Collections.unmodifiableList(mainchain); } } MiningMainchainViewImpl(BlockStore blockStore, int height); void addBest(BlockHeader...
@Test(expected = IllegalArgumentException.class) public void instantiateMaxPlusOne() { new Uint24(Uint24.MAX_VALUE.intValue() + 1); }
public int intValue() { return intValue; }
Uint24 implements Comparable<Uint24> { public int intValue() { return intValue; } }
Uint24 implements Comparable<Uint24> { public int intValue() { return intValue; } Uint24(int intValue); }
Uint24 implements Comparable<Uint24> { public int intValue() { return intValue; } Uint24(int intValue); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(Uint24 o); @Override String toString(); static Uint24 decode(byte[] bytes, int offset); }
Uint24 implements Comparable<Uint24> { public int intValue() { return intValue; } Uint24(int intValue); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(Uint24 o); @Override String toString(); static Uint24 decode(byte[] bytes, int offset); static fi...
@Test public void decodeOffsettedValue() { byte[] bytes = new byte[] {0x21, 0x53, (byte) 0xf2, (byte) 0xf4, 0x04, 0x55}; Uint24 decoded = Uint24.decode(bytes, 2); assertThat(decoded, is(new Uint24(15922180))); }
public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); }
Uint24 implements Comparable<Uint24> { public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); } }
Uint24 implements Comparable<Uint24> { public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); } Uint24(int intValue); }
Uint24 implements Comparable<Uint24> { public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); } Uint24(int intValue); byte[] encode(); int intValue(); @Override boolean equals(O...
Uint24 implements Comparable<Uint24> { public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); } Uint24(int intValue); byte[] encode(); int intValue(); @Override boolean equals(O...
@Test(expected = ArrayIndexOutOfBoundsException.class) public void decodeSmallArray() { byte[] bytes = new byte[] {0x21, 0x53, (byte) 0xf2}; Uint24.decode(bytes, 2); }
public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); }
Uint24 implements Comparable<Uint24> { public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); } }
Uint24 implements Comparable<Uint24> { public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); } Uint24(int intValue); }
Uint24 implements Comparable<Uint24> { public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); } Uint24(int intValue); byte[] encode(); int intValue(); @Override boolean equals(O...
Uint24 implements Comparable<Uint24> { public static Uint24 decode(byte[] bytes, int offset) { int intValue = (bytes[offset + 2] & 0xFF) + ((bytes[offset + 1] & 0xFF) << 8) + ((bytes[offset ] & 0xFF) << 16); return new Uint24(intValue); } Uint24(int intValue); byte[] encode(); int intValue(); @Override boolean equals(O...
@Test public void asByteReturnsByteValue() { Uint8 fortyTwo = new Uint8(42); assertThat(fortyTwo.asByte(), is((byte)42)); }
public byte asByte() { return (byte) intValue; }
Uint8 { public byte asByte() { return (byte) intValue; } }
Uint8 { public byte asByte() { return (byte) intValue; } Uint8(int intValue); }
Uint8 { public byte asByte() { return (byte) intValue; } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 decode(byte[] bytes, int offset); }
Uint8 { public byte asByte() { return (byte) intValue; } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 decode(byte[] bytes, int offset); static final int BYTES; static final Uint8 MAX_VALUE; }
@Test(expected = IllegalArgumentException.class) public void instantiateMaxPlusOne() { new Uint8((Uint8.MAX_VALUE.intValue() + 1)); }
public int intValue() { return intValue; }
Uint8 { public int intValue() { return intValue; } }
Uint8 { public int intValue() { return intValue; } Uint8(int intValue); }
Uint8 { public int intValue() { return intValue; } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 decode(byte[] bytes, int offset); }
Uint8 { public int intValue() { return intValue; } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 decode(byte[] bytes, int offset); static final int BYTES; static final Uint8 MAX_VALUE; }
@Test public void testEncodeSet_2(){ Set<ByteArrayWrapper> data = new HashSet<>(); byte[] setEncoded = encodeSet(data); assertEquals("c0", ByteUtil.toHexString(setEncoded)); }
public static byte[] encodeSet(Set<ByteArrayWrapper> data) { int dataLength = 0; Set<byte[]> encodedElements = new HashSet<>(); for (ByteArrayWrapper element : data) { byte[] encodedElement = RLP.encodeElement(element.getData()); dataLength += encodedElement.length; encodedElements.add(encodedElement); } byte[] listHea...
RLP { public static byte[] encodeSet(Set<ByteArrayWrapper> data) { int dataLength = 0; Set<byte[]> encodedElements = new HashSet<>(); for (ByteArrayWrapper element : data) { byte[] encodedElement = RLP.encodeElement(element.getData()); dataLength += encodedElement.length; encodedElements.add(encodedElement); } byte[] l...
RLP { public static byte[] encodeSet(Set<ByteArrayWrapper> data) { int dataLength = 0; Set<byte[]> encodedElements = new HashSet<>(); for (ByteArrayWrapper element : data) { byte[] encodedElement = RLP.encodeElement(element.getData()); dataLength += encodedElement.length; encodedElements.add(encodedElement); } byte[] l...
RLP { public static byte[] encodeSet(Set<ByteArrayWrapper> data) { int dataLength = 0; Set<byte[]> encodedElements = new HashSet<>(); for (ByteArrayWrapper element : data) { byte[] encodedElement = RLP.encodeElement(element.getData()); dataLength += encodedElement.length; encodedElements.add(encodedElement); } byte[] l...
RLP { public static byte[] encodeSet(Set<ByteArrayWrapper> data) { int dataLength = 0; Set<byte[]> encodedElements = new HashSet<>(); for (ByteArrayWrapper element : data) { byte[] encodedElement = RLP.encodeElement(element.getData()); dataLength += encodedElement.length; encodedElements.add(encodedElement); } byte[] l...
@Test public void decodeOffsettedValue() { byte[] bytes = new byte[] {0x21, 0x53, (byte) 0xf3, (byte) 0xf4, 0x04, 0x55}; Uint8 decoded = Uint8.decode(bytes, 2); assertThat(decoded, is(new Uint8(243))); }
public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); }
Uint8 { public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); } }
Uint8 { public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); } Uint8(int intValue); }
Uint8 { public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 decode(byte[] byt...
Uint8 { public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 decode(byte[] byt...
@Test(expected = ArrayIndexOutOfBoundsException.class) public void decodeSmallArray() { byte[] bytes = new byte[] {0x21, 0x53, (byte) 0xf2}; Uint8.decode(bytes, 3); }
public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); }
Uint8 { public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); } }
Uint8 { public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); } Uint8(int intValue); }
Uint8 { public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 decode(byte[] byt...
Uint8 { public static Uint8 decode(byte[] bytes, int offset) { int intValue = bytes[offset] & 0xFF; return new Uint8(intValue); } Uint8(int intValue); byte asByte(); byte[] encode(); int intValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Uint8 decode(byte[] byt...
@Test public void testEquals() { RskAddress senderA = new RskAddress("0000000000000000000000000000000001000006"); RskAddress senderB = new RskAddress("0000000000000000000000000000000001000006"); RskAddress senderC = new RskAddress("0000000000000000000000000000000001000008"); RskAddress senderD = RskAddress.nullAddress(...
@Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } RskAddress otherSender = (RskAddress) other; return Arrays.equals(bytes, otherSender.bytes); }
RskAddress { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } RskAddress otherSender = (RskAddress) other; return Arrays.equals(bytes, otherSender.bytes); } }
RskAddress { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } RskAddress otherSender = (RskAddress) other; return Arrays.equals(bytes, otherSender.bytes); } RskAddress(DataWord address); RskAddress(String add...
RskAddress { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } RskAddress otherSender = (RskAddress) other; return Arrays.equals(bytes, otherSender.bytes); } RskAddress(DataWord address); RskAddress(String add...
RskAddress { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } RskAddress otherSender = (RskAddress) other; return Arrays.equals(bytes, otherSender.bytes); } RskAddress(DataWord address); RskAddress(String add...
@Test public void zeroAddress() { RskAddress senderA = new RskAddress("0000000000000000000000000000000000000000"); RskAddress senderB = new RskAddress("0x0000000000000000000000000000000000000000"); RskAddress senderC = new RskAddress(new byte[20]); Assert.assertEquals(senderA, senderB); Assert.assertEquals(senderB, sen...
public static RskAddress nullAddress() { return NULL_ADDRESS; }
RskAddress { public static RskAddress nullAddress() { return NULL_ADDRESS; } }
RskAddress { public static RskAddress nullAddress() { return NULL_ADDRESS; } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); }
RskAddress { public static RskAddress nullAddress() { return NULL_ADDRESS; } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); static RskAddress nullAddress(); byte[] getBytes(); String toHexString(); @Override boolean equals(Object other); @Override int hashCo...
RskAddress { public static RskAddress nullAddress() { return NULL_ADDRESS; } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); static RskAddress nullAddress(); byte[] getBytes(); String toHexString(); @Override boolean equals(Object other); @Override int hashCo...
@Test public void nullAddress() { Assert.assertArrayEquals(RskAddress.nullAddress().getBytes(), new byte[0]); }
public static RskAddress nullAddress() { return NULL_ADDRESS; }
RskAddress { public static RskAddress nullAddress() { return NULL_ADDRESS; } }
RskAddress { public static RskAddress nullAddress() { return NULL_ADDRESS; } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); }
RskAddress { public static RskAddress nullAddress() { return NULL_ADDRESS; } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); static RskAddress nullAddress(); byte[] getBytes(); String toHexString(); @Override boolean equals(Object other); @Override int hashCo...
RskAddress { public static RskAddress nullAddress() { return NULL_ADDRESS; } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); static RskAddress nullAddress(); byte[] getBytes(); String toHexString(); @Override boolean equals(Object other); @Override int hashCo...
@Test public void jsonString_otherAddress() { String address = "0x0000000000000000000000000000000000000001"; RskAddress rskAddress = new RskAddress(address); Assert.assertEquals(address, rskAddress.toJsonString()); }
public String toJsonString() { if (NULL_ADDRESS.equals(this)) { return null; } return TypeConverter.toUnformattedJsonHex(this.getBytes()); }
RskAddress { public String toJsonString() { if (NULL_ADDRESS.equals(this)) { return null; } return TypeConverter.toUnformattedJsonHex(this.getBytes()); } }
RskAddress { public String toJsonString() { if (NULL_ADDRESS.equals(this)) { return null; } return TypeConverter.toUnformattedJsonHex(this.getBytes()); } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); }
RskAddress { public String toJsonString() { if (NULL_ADDRESS.equals(this)) { return null; } return TypeConverter.toUnformattedJsonHex(this.getBytes()); } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); static RskAddress nullAddress(); byte[] getBytes(); Strin...
RskAddress { public String toJsonString() { if (NULL_ADDRESS.equals(this)) { return null; } return TypeConverter.toUnformattedJsonHex(this.getBytes()); } RskAddress(DataWord address); RskAddress(String address); RskAddress(byte[] bytes); private RskAddress(); static RskAddress nullAddress(); byte[] getBytes(); Strin...
@Test public void zeroGetBytes() { assertThat(Coin.ZERO.getBytes(), is(new byte[]{0})); }
public byte[] getBytes() { return value.toByteArray(); }
Coin implements Comparable<Coin> { public byte[] getBytes() { return value.toByteArray(); } }
Coin implements Comparable<Coin> { public byte[] getBytes() { return value.toByteArray(); } Coin(byte[] value); Coin(BigInteger value); }
Coin implements Comparable<Coin> { public byte[] getBytes() { return value.toByteArray(); } Coin(byte[] value); Coin(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); Coin negate(); Coin add(Coin val); Coin subtract(Coin val); Coin multiply(BigInteger val); Coin divide(BigInteger val); Coin[] divideAndR...
Coin implements Comparable<Coin> { public byte[] getBytes() { return value.toByteArray(); } Coin(byte[] value); Coin(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); Coin negate(); Coin add(Coin val); Coin subtract(Coin val); Coin multiply(BigInteger val); Coin divide(BigInteger val); Coin[] divideAndR...
@Test public void leftPad() { int paddedLength = 8; TrieKeySlice initialKey = TrieKeySlice.fromKey(new byte[]{(byte) 0xff}); TrieKeySlice leftPaddedKey = initialKey.leftPad(paddedLength); Assert.assertThat(leftPaddedKey.length(), is(initialKey.length() + paddedLength)); Assert.assertArrayEquals( PathEncoder.encode(new ...
public TrieKeySlice leftPad(int paddingLength) { if (paddingLength == 0) { return this; } int currentLength = length(); byte[] paddedExpandedKey = new byte[currentLength + paddingLength]; System.arraycopy(expandedKey, offset, paddedExpandedKey, paddingLength, currentLength); return new TrieKeySlice(paddedExpandedKey, 0...
TrieKeySlice { public TrieKeySlice leftPad(int paddingLength) { if (paddingLength == 0) { return this; } int currentLength = length(); byte[] paddedExpandedKey = new byte[currentLength + paddingLength]; System.arraycopy(expandedKey, offset, paddedExpandedKey, paddingLength, currentLength); return new TrieKeySlice(padde...
TrieKeySlice { public TrieKeySlice leftPad(int paddingLength) { if (paddingLength == 0) { return this; } int currentLength = length(); byte[] paddedExpandedKey = new byte[currentLength + paddingLength]; System.arraycopy(expandedKey, offset, paddedExpandedKey, paddingLength, currentLength); return new TrieKeySlice(padde...
TrieKeySlice { public TrieKeySlice leftPad(int paddingLength) { if (paddingLength == 0) { return this; } int currentLength = length(); byte[] paddedExpandedKey = new byte[currentLength + paddingLength]; System.arraycopy(expandedKey, offset, paddedExpandedKey, paddingLength, currentLength); return new TrieKeySlice(padde...
TrieKeySlice { public TrieKeySlice leftPad(int paddingLength) { if (paddingLength == 0) { return this; } int currentLength = length(); byte[] paddedExpandedKey = new byte[currentLength + paddingLength]; System.arraycopy(expandedKey, offset, paddedExpandedKey, paddingLength, currentLength); return new TrieKeySlice(padde...
@Test public void saveTrieNode() { Trie trie = new Trie(store).put("foo", "bar".getBytes()); store.save(trie); verify(map, times(1)).put(trie.getHash().getBytes(), trie.toMessage()); verify(map, times(1)).get(trie.getHash().getBytes()); verifyNoMoreInteractions(map); }
@Override public void save(Trie trie) { save(trie, true); }
TrieStoreImpl implements TrieStore { @Override public void save(Trie trie) { save(trie, true); } }
TrieStoreImpl implements TrieStore { @Override public void save(Trie trie) { save(trie, true); } TrieStoreImpl(KeyValueDataSource store); }
TrieStoreImpl implements TrieStore { @Override public void save(Trie trie) { save(trie, true); } TrieStoreImpl(KeyValueDataSource store); @Override void save(Trie trie); @Override void flush(); @Override Optional<Trie> retrieve(byte[] hash); @Override byte[] retrieveValue(byte[] hash); @Override void dispose(); }
TrieStoreImpl implements TrieStore { @Override public void save(Trie trie) { save(trie, true); } TrieStoreImpl(KeyValueDataSource store); @Override void save(Trie trie); @Override void flush(); @Override Optional<Trie> retrieve(byte[] hash); @Override byte[] retrieveValue(byte[] hash); @Override void dispose(); }