From 4e2e3149b617f6749e488859d2cd906415e10e29 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 5 Feb 2014 01:16:11 +0000 Subject: Latest RLP standard. Lists specify length rather than itemCount. --- rlp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rlp.cpp') diff --git a/rlp.cpp b/rlp.cpp index 931d5fe4..0f6dada5 100644 --- a/rlp.cpp +++ b/rlp.cpp @@ -35,12 +35,12 @@ int rlpTest() assert(asString(rlp("dog")) == "\x83""dog"); // 2-item list - string twoItemListString = "\xc2\x0f\x83""dog"; + string twoItemListString = "\xc5\x0f\x83""dog"; RLP twoItemList(twoItemListString); assert(twoItemList.itemCount() == 2); assert(twoItemList[0] == 15); assert(twoItemList[1] == "dog"); - assert(asString(rlpList(15, "dog")) == "\xc2\x0f\x83""dog"); + assert(asString(rlpList(15, "dog")) == "\xc5\x0f\x83""dog"); // null assert(RLP("\x80") == ""); @@ -56,7 +56,7 @@ int rlpTest() // 32-byte (256-bit) int assert(RLP("\xa0\x10\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f") == bigint("0x100102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f")); - assert(asString(rlp(bigint("0x100102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"))) == "\x37\x10\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"); + assert(asString(rlp(bigint("0x100102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"))) == "\xa0\x10\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"); // 56-character string. assert(RLP("\xb8\x38""Lorem ipsum dolor sit amet, consectetur adipisicing elit") == "Lorem ipsum dolor sit amet, consectetur adipisicing elit"); -- cgit