mirror of
https://github.com/status-im/ethereumj-personal.git
synced 2025-01-27 04:05:44 +00:00
Simple tool to test , long messages form file
This commit is contained in:
parent
87f1c7a1b8
commit
a0e379e54a
@ -1,31 +1,31 @@
|
||||
package org.ethereum.net;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.ethereum.core.Block;
|
||||
import org.ethereum.core.Transaction;
|
||||
import org.ethereum.crypto.ECKey;
|
||||
import org.ethereum.crypto.HashUtil;
|
||||
import org.ethereum.net.client.PeerData;
|
||||
import org.ethereum.net.message.BlocksMessage;
|
||||
import org.ethereum.net.message.DisconnectMessage;
|
||||
import org.ethereum.net.message.GetChainMessage;
|
||||
import org.ethereum.net.message.HelloMessage;
|
||||
import org.ethereum.net.message.NotInChainMessage;
|
||||
import org.ethereum.net.message.PeersMessage;
|
||||
import org.ethereum.net.message.ReasonCode;
|
||||
import org.ethereum.net.message.TransactionsMessage;
|
||||
import org.ethereum.net.message.*;
|
||||
import org.ethereum.util.ByteUtil;
|
||||
import org.ethereum.util.RLP;
|
||||
import org.ethereum.util.RLPList;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
public class MessagesTest {
|
||||
|
||||
/* HELLO_MESSAGE */
|
||||
@ -438,5 +438,41 @@ public class MessagesTest {
|
||||
|
||||
assertEquals(expected, Hex.toHexString( transactionsMessage.getPayload()) );
|
||||
}
|
||||
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void test16() {
|
||||
String blocksRaw = "f9077cf8d5a03dccb1244db4b3da3f183e4567b33b1aca18a58778495fa895251b254da7afbda01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347943a587078e64080ada2f91adeb51bdd7f8f136311a0e3d2aae526c696f87b17adce72b7f5c69e96beda9a9080f2e7280b370b7fe6bea0c5d9c36618d20da85a3534f0455e8f02593e7cdebeaaf0d384611291d2dcd956833bd21a8201498609184e72a000830b121b8232938453b41e0c80a086e6f631a7dc9b43490de94765a213a1c670baf9b76d0547ee90ed59882ae60bf906a1f9056df90546188609184e72a000830186a094000000000000000000000000000000000000000080b904de60016008577f6175746f706173730000000000000000000000000000000000000000000000006009576104a15161003d6020396000546000536020f2007f736574646f7567000000000000000000000000000000000000000000000000006000350e0f61004c596010560f61003c59600060005460206000f2602035601057600160005460206000f260105661005d59600060005460206000f27f67657474797065000000000000000000000000000000000000000000000000006000350e0f61009159600160005460206000f27f676574706f6c6c000000000000000000000000000000000000000000000000006000350e0f6100c65960095660005460206000f27f67657400000000000000000000000000000000000000000000000000000000006000547f616374696f6e74797065730000000000000000000000000000000000000000006020546020600060406000600060105660645c03f1507f67657400000000000000000000000000000000000000000000000000000000006000350e0f61016759600053330e61015e59600060005460206000f23060005460206000f27f736574706f6c6c000000000000000000000000000000000000000000000000006000350e0f6101b459336000530e6101a459600060005460206000f2602035600957600160005460206000f27f6175746f657865637574650000000000000000000000000000000000000000006000350e0f61045e597f67657400000000000000000000000000000000000000000000000000000000006000547f616374696f6e73000000000000000000000000000000000000000000000000006020546020602060406000600060105660645c03f150336020530e61024c59600060005460006000f27f67657400000000000000000000000000000000000000000000000000000000006000547f75736572730000000000000000000000000000000000000000000000000000006020546020600060406000600060105660645c03f1506000536102b35960206000f27f6765747573657264617461616464720000000000000000000000000000000000602054326040546020600060406020600060005360645c03f1506000536102fa5960206000f27f67657400000000000000000000000000000000000000000000000000000000006020547f7265616c657374617465000000000000000000000000000000000000000000006040546020602060406020600060105660645c03f1506020536103615960206020f27f6765746f776e65720000000000000000000000000000000000000000000000006040546020356060546020604060406040600060205360645c03f150600160006020350e6103b05950326040530e6103be59600060005460206000f260006020350e610417597f67657470726963650000000000000000000000000000000000000000000000006040546020356060546020604060406040600060205360645c03f1506040530f61041759600060005460206000f27f736574686f6d65000000000000000000000000000000000000000000000000006040546020356060546020604060406040600060005360645c03f150600160005460206000f260007f6b696c6c000000000000000000000000000000000000000000000000000000006000350e0f6104905950600053330e0f6104975933ff600060005460206000f21ba0e5ec18236c62d6b8fc9ca4c86a06def9e5abe7eb1723b9b425d0d8ea0f4b2d3da07caeaa143c1b5ffa25afc314e33ad8ffffab4600da1c5bd3da9df5d0b4a7ceeea086531b39939d131471df695908cfe27e32fd70f13ab46b236c5bc9f309b07b19821c10f9012ef90107198609184e72a000830186a094cdd710c7e2cb93a39f80a3b25cea455188bfdb8980b8a074616b6500000000000000000000000000000000000000000000000000000000616464616374696f6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000553cca8a94e9529c38d9bb74c762d0f1d90beac3736574686f6d6500000000000000000000000000002240089100000002c10322400891000080b4f980b113";
|
||||
|
||||
// number - 329
|
||||
byte[] payload = Hex.decode(blocksRaw);
|
||||
RLPList rlpList = RLP.decode2(payload);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Ignore
|
||||
@Test /* Block msg decode - found bug tool */
|
||||
public void test17() throws URISyntaxException, IOException {
|
||||
|
||||
URL rlpMsg_1 = ClassLoader
|
||||
.getSystemResource("rlp/rlp-msg-1.dmp");
|
||||
|
||||
File file = new File(rlpMsg_1.toURI());
|
||||
byte[] strData = Files.readAllBytes(file.toPath());
|
||||
byte[] data = Hex.decode(new String(strData));
|
||||
|
||||
RLPList rlpList = RLP.decode2(data);
|
||||
|
||||
|
||||
BlocksMessage msg = new BlocksMessage(rlpList);
|
||||
msg.getBlockDataList().get(0);
|
||||
|
||||
|
||||
System.out.println(msg);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
1
ethereumj-core/src/test/resources/rlp/rlp-msg-1.dmp
Normal file
1
ethereumj-core/src/test/resources/rlp/rlp-msg-1.dmp
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user