org.bitcoinj.params.UnitTestParams Java Examples
The following examples show how to use
org.bitcoinj.params.UnitTestParams.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeterministicKeyChainTest.java From green_android with GNU General Public License v3.0 | 6 votes |
@Test public void derive() throws Exception { ECKey key1 = chain.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); assertFalse(key1.isPubKeyOnly()); ECKey key2 = chain.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); assertFalse(key2.isPubKeyOnly()); final Address address = Address.fromBase58(UnitTestParams.get(), "n1bQNoEx8uhmCzzA5JPG6sFdtsUQhwiQJV"); assertEquals(address, key1.toAddress(UnitTestParams.get())); assertEquals("mnHUcqUVvrfi5kAaXJDQzBb9HsWs78b42R", key2.toAddress(UnitTestParams.get()).toString()); assertEquals(key1, chain.findKeyFromPubHash(address.getHash160())); assertEquals(key2, chain.findKeyFromPubKey(key2.getPubKey())); key1.sign(Sha256Hash.ZERO_HASH); assertFalse(key1.isPubKeyOnly()); ECKey key3 = chain.getKey(KeyChain.KeyPurpose.CHANGE); assertFalse(key3.isPubKeyOnly()); assertEquals("mqumHgVDqNzuXNrszBmi7A2UpmwaPMx4HQ", key3.toAddress(UnitTestParams.get()).toString()); key3.sign(Sha256Hash.ZERO_HASH); assertFalse(key3.isPubKeyOnly()); }
Example #2
Source File: DeterministicKeyChainTest.java From green_android with GNU General Public License v3.0 | 6 votes |
@Test public void deriveAccountOne() throws Exception { long secs = 1389353062L; DeterministicKeyChain chain1 = new AccountOneChain(ENTROPY, "", secs); ECKey key1 = chain1.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); ECKey key2 = chain1.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); final Address address = Address.fromBase58(UnitTestParams.get(), "n2nHHRHs7TiZScTuVhZUkzZfTfVgGYwy6X"); assertEquals(address, key1.toAddress(UnitTestParams.get())); assertEquals("mnp2j9za5zMuz44vNxrJCXXhZsCdh89QXn", key2.toAddress(UnitTestParams.get()).toString()); assertEquals(key1, chain1.findKeyFromPubHash(address.getHash160())); assertEquals(key2, chain1.findKeyFromPubKey(key2.getPubKey())); key1.sign(Sha256Hash.ZERO_HASH); ECKey key3 = chain1.getKey(KeyChain.KeyPurpose.CHANGE); assertEquals("mpjRhk13rvV7vmnszcUQVYVQzy4HLTPTQU", key3.toAddress(UnitTestParams.get()).toString()); key3.sign(Sha256Hash.ZERO_HASH); }
Example #3
Source File: TransactionInputTest.java From GreenBits with GNU General Public License v3.0 | 6 votes |
@Test public void testStandardWalletDisconnect() throws Exception { NetworkParameters params = UnitTestParams.get(); Wallet w = new Wallet(new Context(params)); w.setCoinSelector(new AllowUnconfirmedCoinSelector()); Address a = w.currentReceiveAddress(); Transaction tx1 = FakeTxBuilder.createFakeTxWithoutChangeAddress(params, Coin.COIN, a); w.receivePending(tx1, null); Transaction tx2 = new Transaction(params); tx2.addOutput(Coin.valueOf(99000000), new ECKey()); w.completeTx(SendRequest.forTx(tx2)); TransactionInput txInToDisconnect = tx2.getInput(0); assertEquals(tx1, txInToDisconnect.getOutpoint().fromTx); assertNull(txInToDisconnect.getOutpoint().connectedOutput); txInToDisconnect.disconnect(); assertNull(txInToDisconnect.getOutpoint().fromTx); assertNull(txInToDisconnect.getOutpoint().connectedOutput); }
Example #4
Source File: VersionMessageTest.java From GreenBits with GNU General Public License v3.0 | 6 votes |
@Test // Test that we can decode version messages which miss data which some old nodes may not include public void testDecode() throws Exception { NetworkParameters params = UnitTestParams.get(); VersionMessage ver = new VersionMessage(params, HEX.decode("7111010000000000000000003334a85500000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d00000000000000000f2f626974636f696e6a3a302e31332f0004000000")); assertFalse(ver.relayTxesBeforeFilter); assertEquals(1024, ver.bestHeight); assertEquals("/bitcoinj:0.13/", ver.subVer); ver = new VersionMessage(params, HEX.decode("711101000000000000000000a634a85500000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d00000000000000000f2f626974636f696e6a3a302e31332f0004000001")); assertTrue(ver.relayTxesBeforeFilter); assertEquals(1024, ver.bestHeight); assertEquals("/bitcoinj:0.13/", ver.subVer); ver = new VersionMessage(params, HEX.decode("711101000000000000000000c334a85500000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d00000000000000000f2f626974636f696e6a3a302e31332f0000000001")); assertTrue(ver.relayTxesBeforeFilter); assertEquals(0, ver.bestHeight); assertEquals("/bitcoinj:0.13/", ver.subVer); ver = new VersionMessage(params, HEX.decode("71110100000000000000000048e5e95000000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d0000000000000000")); assertTrue(ver.relayTxesBeforeFilter); assertEquals(0, ver.bestHeight); assertEquals("", ver.subVer); }
Example #5
Source File: VersionMessageTest.java From green_android with GNU General Public License v3.0 | 6 votes |
@Test // Test that we can decode version messages which miss data which some old nodes may not include public void testDecode() throws Exception { NetworkParameters params = UnitTestParams.get(); VersionMessage ver = new VersionMessage(params, HEX.decode("7111010000000000000000003334a85500000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d00000000000000000f2f626974636f696e6a3a302e31332f0004000000")); assertFalse(ver.relayTxesBeforeFilter); assertEquals(1024, ver.bestHeight); assertEquals("/bitcoinj:0.13/", ver.subVer); ver = new VersionMessage(params, HEX.decode("711101000000000000000000a634a85500000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d00000000000000000f2f626974636f696e6a3a302e31332f0004000001")); assertTrue(ver.relayTxesBeforeFilter); assertEquals(1024, ver.bestHeight); assertEquals("/bitcoinj:0.13/", ver.subVer); ver = new VersionMessage(params, HEX.decode("711101000000000000000000c334a85500000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d00000000000000000f2f626974636f696e6a3a302e31332f0000000001")); assertTrue(ver.relayTxesBeforeFilter); assertEquals(0, ver.bestHeight); assertEquals("/bitcoinj:0.13/", ver.subVer); ver = new VersionMessage(params, HEX.decode("71110100000000000000000048e5e95000000000000000000000000000000000000000000000ffff7f000001479d000000000000000000000000000000000000ffff7f000001479d0000000000000000")); assertTrue(ver.relayTxesBeforeFilter); assertEquals(0, ver.bestHeight); assertEquals("", ver.subVer); }
Example #6
Source File: TransactionInputTest.java From green_android with GNU General Public License v3.0 | 6 votes |
@Test public void testStandardWalletDisconnect() throws Exception { NetworkParameters params = UnitTestParams.get(); Wallet w = new Wallet(new Context(params)); w.setCoinSelector(new AllowUnconfirmedCoinSelector()); Address a = w.currentReceiveAddress(); Transaction tx1 = FakeTxBuilder.createFakeTxWithoutChangeAddress(params, Coin.COIN, a); w.receivePending(tx1, null); Transaction tx2 = new Transaction(params); tx2.addOutput(Coin.valueOf(99000000), new ECKey()); w.completeTx(SendRequest.forTx(tx2)); TransactionInput txInToDisconnect = tx2.getInput(0); assertEquals(tx1, txInToDisconnect.getOutpoint().fromTx); assertNull(txInToDisconnect.getOutpoint().connectedOutput); txInToDisconnect.disconnect(); assertNull(txInToDisconnect.getOutpoint().fromTx); assertNull(txInToDisconnect.getOutpoint().connectedOutput); }
Example #7
Source File: DeterministicKeyChainTest.java From GreenBits with GNU General Public License v3.0 | 6 votes |
@Test public void derive() throws Exception { ECKey key1 = chain.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); assertFalse(key1.isPubKeyOnly()); ECKey key2 = chain.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); assertFalse(key2.isPubKeyOnly()); final Address address = Address.fromBase58(UnitTestParams.get(), "n1bQNoEx8uhmCzzA5JPG6sFdtsUQhwiQJV"); assertEquals(address, key1.toAddress(UnitTestParams.get())); assertEquals("mnHUcqUVvrfi5kAaXJDQzBb9HsWs78b42R", key2.toAddress(UnitTestParams.get()).toString()); assertEquals(key1, chain.findKeyFromPubHash(address.getHash160())); assertEquals(key2, chain.findKeyFromPubKey(key2.getPubKey())); key1.sign(Sha256Hash.ZERO_HASH); assertFalse(key1.isPubKeyOnly()); ECKey key3 = chain.getKey(KeyChain.KeyPurpose.CHANGE); assertFalse(key3.isPubKeyOnly()); assertEquals("mqumHgVDqNzuXNrszBmi7A2UpmwaPMx4HQ", key3.toAddress(UnitTestParams.get()).toString()); key3.sign(Sha256Hash.ZERO_HASH); assertFalse(key3.isPubKeyOnly()); }
Example #8
Source File: DeterministicKeyChainTest.java From GreenBits with GNU General Public License v3.0 | 6 votes |
@Test public void deriveAccountOne() throws Exception { long secs = 1389353062L; DeterministicKeyChain chain1 = new AccountOneChain(ENTROPY, "", secs); ECKey key1 = chain1.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); ECKey key2 = chain1.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); final Address address = Address.fromBase58(UnitTestParams.get(), "n2nHHRHs7TiZScTuVhZUkzZfTfVgGYwy6X"); assertEquals(address, key1.toAddress(UnitTestParams.get())); assertEquals("mnp2j9za5zMuz44vNxrJCXXhZsCdh89QXn", key2.toAddress(UnitTestParams.get()).toString()); assertEquals(key1, chain1.findKeyFromPubHash(address.getHash160())); assertEquals(key2, chain1.findKeyFromPubKey(key2.getPubKey())); key1.sign(Sha256Hash.ZERO_HASH); ECKey key3 = chain1.getKey(KeyChain.KeyPurpose.CHANGE); assertEquals("mpjRhk13rvV7vmnszcUQVYVQzy4HLTPTQU", key3.toAddress(UnitTestParams.get()).toString()); key3.sign(Sha256Hash.ZERO_HASH); }
Example #9
Source File: SPVBlockStoreTest.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Test public void basics() throws Exception { NetworkParameters params = UnitTestParams.get(); File f = File.createTempFile("spvblockstore", null); f.delete(); f.deleteOnExit(); SPVBlockStore store = new SPVBlockStore(params, f); Address to = new ECKey().toAddress(params); // Check the first block in a new store is the genesis block. StoredBlock genesis = store.getChainHead(); assertEquals(params.getGenesisBlock(), genesis.getHeader()); assertEquals(0, genesis.getHeight()); // Build a new block. StoredBlock b1 = genesis.build(genesis.getHeader().createNextBlock(to).cloneAsHeader()); store.put(b1); store.setChainHead(b1); store.close(); // Check we can get it back out again if we rebuild the store object. store = new SPVBlockStore(params, f); StoredBlock b2 = store.get(b1.getHeader().getHash()); assertEquals(b1, b2); // Check the chain head was stored correctly also. StoredBlock chainHead = store.getChainHead(); assertEquals(b1, chainHead); }
Example #10
Source File: AlertMessageTest.java From bcm-android with GNU General Public License v3.0 | 5 votes |
@Before public void setUp() throws Exception { final ECKey key = ECKey.fromPrivate(TEST_KEY_PRIV); params = new UnitTestParams() { @Override public byte[] getAlertSigningKey() { return key.getPubKey(); } }; }
Example #11
Source File: TransactionInputTest.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Test public void testUTXOWalletDisconnect() throws Exception { final NetworkParameters params = UnitTestParams.get(); Wallet w = new Wallet(new Context(params)); Address a = w.currentReceiveAddress(); final UTXO utxo = new UTXO(Sha256Hash.of(new byte[] { 1, 2, 3 }), 1, Coin.COIN, 0, false, ScriptBuilder.createOutputScript(a)); w.setUTXOProvider(new UTXOProvider() { @Override public NetworkParameters getParams() { return params; } @Override public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException { return Lists.newArrayList(utxo); } @Override public int getChainHeadHeight() throws UTXOProviderException { return Integer.MAX_VALUE; } }); Transaction tx2 = new Transaction(params); tx2.addOutput(Coin.valueOf(99000000), new ECKey()); w.completeTx(SendRequest.forTx(tx2)); TransactionInput txInToDisconnect = tx2.getInput(0); assertNull(txInToDisconnect.getOutpoint().fromTx); assertEquals(utxo.getHash(), txInToDisconnect.getOutpoint().connectedOutput.getParentTransactionHash()); txInToDisconnect.disconnect(); assertNull(txInToDisconnect.getOutpoint().fromTx); assertNull(txInToDisconnect.getOutpoint().connectedOutput); }
Example #12
Source File: BlockTest.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Test public void testUpdateLength() { NetworkParameters params = UnitTestParams.get(); Block block = params.getGenesisBlock().createNextBlockWithCoinbase(Block.BLOCK_VERSION_GENESIS, new ECKey().getPubKey(), Block.BLOCK_HEIGHT_GENESIS); assertEquals(block.bitcoinSerialize().length, block.length); final int origBlockLen = block.length; Transaction tx = new Transaction(params); // this is broken until the transaction has > 1 input + output (which is required anyway...) //assertTrue(tx.length == tx.bitcoinSerialize().length && tx.length == 8); byte[] outputScript = new byte[10]; Arrays.fill(outputScript, (byte) ScriptOpCodes.OP_FALSE); tx.addOutput(new TransactionOutput(params, null, Coin.SATOSHI, outputScript)); tx.addInput(new TransactionInput(params, null, new byte[] {(byte) ScriptOpCodes.OP_FALSE}, new TransactionOutPoint(params, 0, Sha256Hash.of(new byte[] { 1 })))); int origTxLength = 8 + 2 + 8 + 1 + 10 + 40 + 1 + 1; assertEquals(tx.unsafeBitcoinSerialize().length, tx.length); assertEquals(origTxLength, tx.length); block.addTransaction(tx); assertEquals(block.unsafeBitcoinSerialize().length, block.length); assertEquals(origBlockLen + tx.length, block.length); block.getTransactions().get(1).getInputs().get(0).setScriptBytes(new byte[] {(byte) ScriptOpCodes.OP_FALSE, (byte) ScriptOpCodes.OP_FALSE}); assertEquals(block.length, origBlockLen + tx.length); assertEquals(tx.length, origTxLength + 1); block.getTransactions().get(1).getInputs().get(0).clearScriptBytes(); assertEquals(block.length, block.unsafeBitcoinSerialize().length); assertEquals(block.length, origBlockLen + tx.length); assertEquals(tx.length, origTxLength - 1); block.getTransactions().get(1).addInput(new TransactionInput(params, null, new byte[] {(byte) ScriptOpCodes.OP_FALSE}, new TransactionOutPoint(params, 0, Sha256Hash.of(new byte[] { 1 })))); assertEquals(block.length, origBlockLen + tx.length); assertEquals(tx.length, origTxLength + 41); // - 1 + 40 + 1 + 1 }
Example #13
Source File: ECKeyTest.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Test public void roundTripDumpedPrivKey() throws Exception { ECKey key = new ECKey(); assertTrue(key.isCompressed()); NetworkParameters params = UnitTestParams.get(); String base58 = key.getPrivateKeyEncoded(params).toString(); ECKey key2 = DumpedPrivateKey.fromBase58(params, base58).getKey(); assertTrue(key2.isCompressed()); assertTrue(Arrays.equals(key.getPrivKeyBytes(), key2.getPrivKeyBytes())); assertTrue(Arrays.equals(key.getPubKey(), key2.getPubKey())); }
Example #14
Source File: AlertMessageTest.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Before public void setUp() throws Exception { final ECKey key = ECKey.fromPrivate(TEST_KEY_PRIV); params = new UnitTestParams() { @Override public byte[] getAlertSigningKey() { return key.getPubKey(); } }; }
Example #15
Source File: MessageTest.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Test(expected = ProtocolException.class) public void readByteArrayOfExtremeLength() throws Exception { NetworkParameters params = UnitTestParams.get(); VarInt length = new VarInt(Integer.MAX_VALUE); byte[] payload = length.encode(); new VarBytesMessage(params, payload); }
Example #16
Source File: MessageTest.java From GreenBits with GNU General Public License v3.0 | 5 votes |
@Test(expected = ProtocolException.class) public void readStrOfExtremeLength() throws Exception { NetworkParameters params = UnitTestParams.get(); VarInt length = new VarInt(Integer.MAX_VALUE); byte[] payload = length.encode(); new VarStrMessage(params, payload); }
Example #17
Source File: SPVBlockStoreTest.java From green_android with GNU General Public License v3.0 | 5 votes |
@Test public void basics() throws Exception { NetworkParameters params = UnitTestParams.get(); File f = File.createTempFile("spvblockstore", null); f.delete(); f.deleteOnExit(); SPVBlockStore store = new SPVBlockStore(params, f); Address to = new ECKey().toAddress(params); // Check the first block in a new store is the genesis block. StoredBlock genesis = store.getChainHead(); assertEquals(params.getGenesisBlock(), genesis.getHeader()); assertEquals(0, genesis.getHeight()); // Build a new block. StoredBlock b1 = genesis.build(genesis.getHeader().createNextBlock(to).cloneAsHeader()); store.put(b1); store.setChainHead(b1); store.close(); // Check we can get it back out again if we rebuild the store object. store = new SPVBlockStore(params, f); StoredBlock b2 = store.get(b1.getHeader().getHash()); assertEquals(b1, b2); // Check the chain head was stored correctly also. StoredBlock chainHead = store.getChainHead(); assertEquals(b1, chainHead); }
Example #18
Source File: TransactionInputTest.java From green_android with GNU General Public License v3.0 | 5 votes |
@Test public void testUTXOWalletDisconnect() throws Exception { final NetworkParameters params = UnitTestParams.get(); Wallet w = new Wallet(new Context(params)); Address a = w.currentReceiveAddress(); final UTXO utxo = new UTXO(Sha256Hash.of(new byte[] { 1, 2, 3 }), 1, Coin.COIN, 0, false, ScriptBuilder.createOutputScript(a)); w.setUTXOProvider(new UTXOProvider() { @Override public NetworkParameters getParams() { return params; } @Override public List<UTXO> getOpenTransactionOutputs(List<Address> addresses) throws UTXOProviderException { return Lists.newArrayList(utxo); } @Override public int getChainHeadHeight() throws UTXOProviderException { return Integer.MAX_VALUE; } }); Transaction tx2 = new Transaction(params); tx2.addOutput(Coin.valueOf(99000000), new ECKey()); w.completeTx(SendRequest.forTx(tx2)); TransactionInput txInToDisconnect = tx2.getInput(0); assertNull(txInToDisconnect.getOutpoint().fromTx); assertEquals(utxo.getHash(), txInToDisconnect.getOutpoint().connectedOutput.getParentTransactionHash()); txInToDisconnect.disconnect(); assertNull(txInToDisconnect.getOutpoint().fromTx); assertNull(txInToDisconnect.getOutpoint().connectedOutput); }
Example #19
Source File: BlockTest.java From green_android with GNU General Public License v3.0 | 5 votes |
@Test public void testUpdateLength() { NetworkParameters params = UnitTestParams.get(); Block block = params.getGenesisBlock().createNextBlockWithCoinbase(Block.BLOCK_VERSION_GENESIS, new ECKey().getPubKey(), Block.BLOCK_HEIGHT_GENESIS); assertEquals(block.bitcoinSerialize().length, block.length); final int origBlockLen = block.length; Transaction tx = new Transaction(params); // this is broken until the transaction has > 1 input + output (which is required anyway...) //assertTrue(tx.length == tx.bitcoinSerialize().length && tx.length == 8); byte[] outputScript = new byte[10]; Arrays.fill(outputScript, (byte) ScriptOpCodes.OP_FALSE); tx.addOutput(new TransactionOutput(params, null, Coin.SATOSHI, outputScript)); tx.addInput(new TransactionInput(params, null, new byte[] {(byte) ScriptOpCodes.OP_FALSE}, new TransactionOutPoint(params, 0, Sha256Hash.of(new byte[] { 1 })))); int origTxLength = 8 + 2 + 8 + 1 + 10 + 40 + 1 + 1; assertEquals(tx.unsafeBitcoinSerialize().length, tx.length); assertEquals(origTxLength, tx.length); block.addTransaction(tx); assertEquals(block.unsafeBitcoinSerialize().length, block.length); assertEquals(origBlockLen + tx.length, block.length); block.getTransactions().get(1).getInputs().get(0).setScriptBytes(new byte[] {(byte) ScriptOpCodes.OP_FALSE, (byte) ScriptOpCodes.OP_FALSE}); assertEquals(block.length, origBlockLen + tx.length); assertEquals(tx.length, origTxLength + 1); block.getTransactions().get(1).getInputs().get(0).clearScriptBytes(); assertEquals(block.length, block.unsafeBitcoinSerialize().length); assertEquals(block.length, origBlockLen + tx.length); assertEquals(tx.length, origTxLength - 1); block.getTransactions().get(1).addInput(new TransactionInput(params, null, new byte[] {(byte) ScriptOpCodes.OP_FALSE}, new TransactionOutPoint(params, 0, Sha256Hash.of(new byte[] { 1 })))); assertEquals(block.length, origBlockLen + tx.length); assertEquals(tx.length, origTxLength + 41); // - 1 + 40 + 1 + 1 }
Example #20
Source File: ECKeyTest.java From green_android with GNU General Public License v3.0 | 5 votes |
@Test public void roundTripDumpedPrivKey() throws Exception { ECKey key = new ECKey(); assertTrue(key.isCompressed()); NetworkParameters params = UnitTestParams.get(); String base58 = key.getPrivateKeyEncoded(params).toString(); ECKey key2 = DumpedPrivateKey.fromBase58(params, base58).getKey(); assertTrue(key2.isCompressed()); assertTrue(Arrays.equals(key.getPrivKeyBytes(), key2.getPrivKeyBytes())); assertTrue(Arrays.equals(key.getPubKey(), key2.getPubKey())); }
Example #21
Source File: AlertMessageTest.java From green_android with GNU General Public License v3.0 | 5 votes |
@Before public void setUp() throws Exception { final ECKey key = ECKey.fromPrivate(TEST_KEY_PRIV); params = new UnitTestParams() { @Override public byte[] getAlertSigningKey() { return key.getPubKey(); } }; }
Example #22
Source File: MessageTest.java From green_android with GNU General Public License v3.0 | 5 votes |
@Test(expected = ProtocolException.class) public void readByteArrayOfExtremeLength() throws Exception { NetworkParameters params = UnitTestParams.get(); VarInt length = new VarInt(Integer.MAX_VALUE); byte[] payload = length.encode(); new VarBytesMessage(params, payload); }
Example #23
Source File: MessageTest.java From green_android with GNU General Public License v3.0 | 5 votes |
@Test(expected = ProtocolException.class) public void readStrOfExtremeLength() throws Exception { NetworkParameters params = UnitTestParams.get(); VarInt length = new VarInt(Integer.MAX_VALUE); byte[] payload = length.encode(); new VarStrMessage(params, payload); }
Example #24
Source File: TestWithNetworkConnections.java From GreenBits with GNU General Public License v3.0 | 4 votes |
public void setUp() throws Exception { setUp(new MemoryBlockStore(UnitTestParams.get())); }
Example #25
Source File: TestWithNetworkConnections.java From green_android with GNU General Public License v3.0 | 4 votes |
public void setUp() throws Exception { setUp(new MemoryBlockStore(UnitTestParams.get())); }