diff --git a/Libplanet.Tests/Blocks/BlockTest.cs b/Libplanet.Tests/Blocks/BlockTest.cs index 38ca013199..95a826301f 100644 --- a/Libplanet.Tests/Blocks/BlockTest.cs +++ b/Libplanet.Tests/Blocks/BlockTest.cs @@ -103,22 +103,17 @@ public void CanMine() [Fact] public void ToBencodex() { - byte[] expected = new byte[185] + byte[] expected = new byte[126] { - 0x64, 0x75, 0x36, 0x3a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x64, 0x75, 0x31, 0x30, - 0x3a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x69, 0x30, 0x65, - 0x75, 0x34, 0x3a, 0x68, 0x61, 0x73, 0x68, 0x33, 0x32, 0x3a, 0xd4, 0xf3, 0x58, 0x34, - 0xe2, 0x7d, 0x5a, 0xb4, 0x59, 0xa4, 0xd4, 0x01, 0xe9, 0xa0, 0x82, 0x68, 0xe3, 0xfe, - 0x32, 0x1b, 0x8c, 0x68, 0x50, 0x75, 0xae, 0xc5, 0xbd, 0x5d, 0x18, 0xd6, 0x42, 0xaa, - 0x75, 0x35, 0x3a, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x69, 0x30, 0x65, 0x75, 0x35, 0x3a, - 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x34, 0x3a, 0x01, 0x00, 0x00, 0x00, 0x75, 0x31, 0x38, - 0x3a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x5f, 0x62, 0x65, 0x6e, 0x65, 0x66, 0x69, - 0x63, 0x69, 0x61, 0x72, 0x79, 0x32, 0x30, 0x3a, 0x21, 0x74, 0x4f, 0x4f, 0x08, 0xdb, - 0x23, 0xe0, 0x44, 0x17, 0x8d, 0xaf, 0xb8, 0x27, 0x3a, 0xeb, 0x5e, 0xbe, 0x66, 0x44, - 0x75, 0x39, 0x3a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x75, 0x32, - 0x37, 0x3a, 0x32, 0x30, 0x31, 0x38, 0x2d, 0x31, 0x31, 0x2d, 0x32, 0x39, 0x54, 0x30, - 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0x5a, 0x65, 0x65, + 0x64, 0x31, 0x3a, 0x48, 0x64, 0x31, 0x3a, 0x64, 0x69, 0x30, 0x65, 0x31, 0x3a, 0x68, + 0x33, 0x32, 0x3a, 0xd4, 0xf3, 0x58, 0x34, 0xe2, 0x7d, 0x5a, 0xb4, 0x59, 0xa4, 0xd4, + 0x01, 0xe9, 0xa0, 0x82, 0x68, 0xe3, 0xfe, 0x32, 0x1b, 0x8c, 0x68, 0x50, 0x75, 0xae, + 0xc5, 0xbd, 0x5d, 0x18, 0xd6, 0x42, 0xaa, 0x31, 0x3a, 0x69, 0x69, 0x30, 0x65, 0x31, + 0x3a, 0x6d, 0x32, 0x30, 0x3a, 0x21, 0x74, 0x4f, 0x4f, 0x08, 0xdb, 0x23, 0xe0, 0x44, + 0x17, 0x8d, 0xaf, 0xb8, 0x27, 0x3a, 0xeb, 0x5e, 0xbe, 0x66, 0x44, 0x31, 0x3a, 0x6e, + 0x34, 0x3a, 0x01, 0x00, 0x00, 0x00, 0x31, 0x3a, 0x74, 0x75, 0x32, 0x37, 0x3a, 0x32, + 0x30, 0x31, 0x38, 0x2d, 0x31, 0x31, 0x2d, 0x32, 0x39, 0x54, 0x30, 0x30, 0x3a, 0x30, + 0x30, 0x3a, 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x65, 0x65, }; AssertBytesEqual(expected, _fx.Genesis.Serialize()); @@ -127,65 +122,52 @@ public void ToBencodex() [Fact] public void FromBencodex() { - byte[] encoded = new byte[791] + byte[] encoded = new byte[615] { - 0x64, 0x75, 0x36, 0x3a, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x64, 0x75, 0x31, 0x30, - 0x3a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x69, 0x31, 0x65, - 0x75, 0x34, 0x3a, 0x68, 0x61, 0x73, 0x68, 0x33, 0x32, 0x3a, 0x5f, 0xaf, 0x15, 0x92, - 0x49, 0x44, 0xe0, 0xe5, 0x67, 0x62, 0x97, 0xeb, 0x55, 0x8d, 0xc7, 0x76, 0xe9, 0x03, - 0x55, 0x42, 0xc4, 0xe6, 0x47, 0xe3, 0x84, 0x74, 0x24, 0xa0, 0xdd, 0x60, 0xed, 0x4d, - 0x75, 0x35, 0x3a, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x69, 0x32, 0x65, 0x75, 0x35, 0x3a, - 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x31, 0x30, 0x3a, 0x5c, 0x77, 0x74, 0xc2, 0x39, 0x69, - 0x37, 0x51, 0x87, 0xa5, 0x75, 0x31, 0x33, 0x3a, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, - 0x75, 0x73, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x33, 0x32, 0x3a, 0x7f, 0x8b, 0xd1, 0x81, - 0x0f, 0x90, 0x79, 0xfa, 0x79, 0xc3, 0x00, 0x0f, 0x8d, 0xfa, 0x79, 0x4e, 0x45, 0xac, - 0xe6, 0x80, 0x26, 0x3b, 0x22, 0xc1, 0xd9, 0x2d, 0x1a, 0xb4, 0xbf, 0x73, 0x34, 0x14, - 0x75, 0x31, 0x38, 0x3a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x5f, 0x62, 0x65, 0x6e, - 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, 0x79, 0x32, 0x30, 0x3a, 0x21, 0x74, 0x4f, - 0x4f, 0x08, 0xdb, 0x23, 0xe0, 0x44, 0x17, 0x8d, 0xaf, 0xb8, 0x27, 0x3a, 0xeb, 0x5e, - 0xbe, 0x66, 0x44, 0x75, 0x39, 0x3a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x75, 0x32, 0x37, 0x3a, 0x32, 0x30, 0x31, 0x38, 0x2d, 0x31, 0x32, 0x2d, 0x30, - 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x30, 0x5a, 0x75, 0x32, 0x33, 0x3a, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, - 0x69, 0x6e, 0x74, 0x33, 0x32, 0x3a, 0x7f, 0xa3, 0xae, 0x3f, 0x31, 0x7a, 0x7e, 0x64, - 0xe9, 0xb9, 0x74, 0x9a, 0x6a, 0xfb, 0xad, 0x21, 0x32, 0x20, 0x36, 0xda, 0x87, 0x2b, - 0x8e, 0x44, 0xb7, 0xce, 0x7c, 0x36, 0xb4, 0xa3, 0x0b, 0xce, 0x65, 0x75, 0x31, 0x32, - 0x3a, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x6c, - 0x34, 0x36, 0x33, 0x3a, 0x64, 0x75, 0x37, 0x3a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x6c, 0x64, 0x75, 0x37, 0x3a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x75, - 0x36, 0x3a, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x75, 0x36, 0x3a, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x64, 0x75, 0x36, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x75, - 0x33, 0x3a, 0x6f, 0x72, 0x63, 0x75, 0x31, 0x34, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x32, 0x30, 0x3a, 0xc2, 0xa8, + 0x64, 0x31, 0x3a, 0x48, 0x64, 0x31, 0x3a, 0x64, 0x69, 0x31, 0x65, 0x31, 0x3a, 0x68, + 0x33, 0x32, 0x3a, 0xb5, 0x13, 0x2d, 0xe9, 0x3f, 0xa5, 0x78, 0x5a, 0x21, 0x3a, 0xcc, + 0x2d, 0x6e, 0xb5, 0x08, 0x14, 0xcd, 0xfe, 0x89, 0x77, 0x19, 0x70, 0x55, 0xf4, 0x03, + 0xbc, 0xc5, 0x6d, 0x91, 0x9d, 0x29, 0x01, 0x31, 0x3a, 0x69, 0x69, 0x32, 0x65, 0x31, + 0x3a, 0x6d, 0x32, 0x30, 0x3a, 0x21, 0x74, 0x4f, 0x4f, 0x08, 0xdb, 0x23, 0xe0, 0x44, + 0x17, 0x8d, 0xaf, 0xb8, 0x27, 0x3a, 0xeb, 0x5e, 0xbe, 0x66, 0x44, 0x31, 0x3a, 0x6e, + 0x31, 0x30, 0x3a, 0x5c, 0x77, 0x74, 0xc2, 0x39, 0x69, 0x37, 0x51, 0x87, 0xa5, 0x31, + 0x3a, 0x70, 0x33, 0x32, 0x3a, 0x7f, 0x8b, 0xd1, 0x81, 0x0f, 0x90, 0x79, 0xfa, 0x79, + 0xc3, 0x00, 0x0f, 0x8d, 0xfa, 0x79, 0x4e, 0x45, 0xac, 0xe6, 0x80, 0x26, 0x3b, 0x22, + 0xc1, 0xd9, 0x2d, 0x1a, 0xb4, 0xbf, 0x73, 0x34, 0x14, 0x31, 0x3a, 0x74, 0x75, 0x32, + 0x37, 0x3a, 0x32, 0x30, 0x31, 0x38, 0x2d, 0x31, 0x32, 0x2d, 0x30, 0x31, 0x54, 0x30, + 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x5a, 0x31, 0x3a, 0x78, 0x33, 0x32, 0x3a, 0xc8, 0xa1, 0xad, 0x57, 0xd8, 0x88, 0x3a, + 0xe1, 0xdc, 0x66, 0x7b, 0xbb, 0xc6, 0xe8, 0xf7, 0x7d, 0x35, 0xf6, 0x2d, 0xaa, 0xfa, + 0x3f, 0x07, 0x6b, 0x34, 0x02, 0xc6, 0x17, 0x54, 0x22, 0xd8, 0xfb, 0x65, 0x31, 0x3a, + 0x54, 0x6c, 0x33, 0x39, 0x37, 0x3a, 0x64, 0x31, 0x3a, 0x53, 0x37, 0x30, 0x3a, 0x30, + 0x44, 0x02, 0x20, 0x4c, 0xf2, 0xd4, 0xd9, 0x22, 0x97, 0xa6, 0x7f, 0xd0, 0x47, 0x69, + 0xf2, 0x53, 0xe2, 0x0e, 0x62, 0x13, 0xf0, 0x63, 0xb8, 0x14, 0x2f, 0xff, 0x4c, 0xb9, + 0xe9, 0xc0, 0x47, 0x33, 0xed, 0xbc, 0x16, 0x02, 0x20, 0x0e, 0xfe, 0xbb, 0x0e, 0x2a, + 0x7b, 0xcf, 0x4d, 0x5c, 0x7a, 0x62, 0x8e, 0xd2, 0xe7, 0xa9, 0x1f, 0x44, 0x0a, 0xfa, + 0x31, 0x19, 0x7f, 0xf6, 0x16, 0xfb, 0x32, 0xd8, 0xba, 0xda, 0xd3, 0xe9, 0xcc, 0x31, + 0x3a, 0x61, 0x6c, 0x64, 0x75, 0x37, 0x3a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x64, + 0x75, 0x36, 0x3a, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x75, 0x36, 0x3a, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x64, 0x75, 0x36, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x75, 0x33, 0x3a, 0x6f, 0x72, 0x63, 0x75, 0x31, 0x34, 0x3a, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x32, 0x30, 0x3a, 0xc2, + 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, + 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x75, 0x36, 0x3a, 0x77, 0x65, 0x61, 0x70, 0x6f, 0x6e, + 0x75, 0x34, 0x3a, 0x77, 0x61, 0x6e, 0x64, 0x65, 0x65, 0x64, 0x75, 0x37, 0x3a, 0x74, + 0x79, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x75, 0x35, 0x3a, 0x73, 0x6c, 0x65, 0x65, 0x70, + 0x75, 0x36, 0x3a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x64, 0x75, 0x37, 0x3a, 0x7a, + 0x6f, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x69, 0x31, 0x30, 0x65, 0x65, 0x65, 0x65, 0x31, + 0x3a, 0x6e, 0x69, 0x30, 0x65, 0x31, 0x3a, 0x70, 0x36, 0x35, 0x3a, 0x04, 0x46, 0x11, + 0x5b, 0x01, 0x31, 0xba, 0xcc, 0xf9, 0x4a, 0x58, 0x56, 0xed, 0xe8, 0x71, 0x29, 0x5f, + 0x6f, 0x3d, 0x35, 0x2e, 0x68, 0x47, 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, 0x09, 0xf7, + 0x32, 0x80, 0x87, 0x11, 0xec, 0x97, 0xaf, 0x6e, 0x34, 0x1f, 0x11, 0x0a, 0x32, 0x6d, + 0xa1, 0xbd, 0xb8, 0x1f, 0x5a, 0xe3, 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, 0xc8, 0xc4, + 0x91, 0xae, 0xd3, 0xaa, 0xa2, 0x96, 0x31, 0x3a, 0x73, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, - 0xfa, 0x4f, 0x5c, 0xbc, 0x75, 0x36, 0x3a, 0x77, 0x65, 0x61, 0x70, 0x6f, 0x6e, 0x75, - 0x34, 0x3a, 0x77, 0x61, 0x6e, 0x64, 0x65, 0x65, 0x64, 0x75, 0x37, 0x3a, 0x74, 0x79, - 0x70, 0x65, 0x5f, 0x69, 0x64, 0x75, 0x35, 0x3a, 0x73, 0x6c, 0x65, 0x65, 0x70, 0x75, - 0x36, 0x3a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x64, 0x75, 0x37, 0x3a, 0x7a, 0x6f, - 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x69, 0x31, 0x30, 0x65, 0x65, 0x65, 0x65, 0x75, 0x35, - 0x3a, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x69, 0x30, 0x65, 0x75, 0x31, 0x30, 0x3a, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x36, 0x35, 0x3a, 0x04, 0x46, - 0x11, 0x5b, 0x01, 0x31, 0xba, 0xcc, 0xf9, 0x4a, 0x58, 0x56, 0xed, 0xe8, 0x71, 0x29, - 0x5f, 0x6f, 0x3d, 0x35, 0x2e, 0x68, 0x47, 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, 0x09, - 0xf7, 0x32, 0x80, 0x87, 0x11, 0xec, 0x97, 0xaf, 0x6e, 0x34, 0x1f, 0x11, 0x0a, 0x32, - 0x6d, 0xa1, 0xbd, 0xb8, 0x1f, 0x5a, 0xe3, 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, 0xc8, - 0xc4, 0x91, 0xae, 0xd3, 0xaa, 0xa2, 0x96, 0x75, 0x39, 0x3a, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x37, 0x31, 0x3a, 0x30, 0x45, 0x02, 0x21, 0x00, 0xff, - 0x59, 0xff, 0x0e, 0x5b, 0x9e, 0xbf, 0xd7, 0xaf, 0xe6, 0x90, 0xed, 0x8c, 0xd4, 0xd7, - 0xa1, 0x6a, 0xb2, 0xdf, 0xc4, 0x42, 0x11, 0xea, 0x9e, 0xff, 0x73, 0xa6, 0x1f, 0x86, - 0x4e, 0xf7, 0xde, 0x02, 0x20, 0x51, 0x34, 0xd5, 0x55, 0xbf, 0x1a, 0x51, 0xcd, 0x45, - 0x78, 0xda, 0x01, 0xb4, 0x6b, 0xe9, 0x95, 0x85, 0x88, 0x4e, 0x21, 0x26, 0xc1, 0x52, - 0x66, 0xfd, 0xb7, 0x5d, 0xe2, 0x18, 0xb0, 0xd6, 0x2e, 0x75, 0x36, 0x3a, 0x73, 0x69, - 0x67, 0x6e, 0x65, 0x72, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, - 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x75, - 0x39, 0x3a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x75, 0x32, 0x37, - 0x3a, 0x32, 0x30, 0x31, 0x38, 0x2d, 0x31, 0x31, 0x2d, 0x32, 0x31, 0x54, 0x30, 0x30, - 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, - 0x75, 0x31, 0x37, 0x3a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x6c, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, - 0x14, 0x07, 0x3d, 0x66, 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, - 0x4f, 0x5c, 0xbc, 0x65, 0x65, 0x65, 0x65, + 0xfa, 0x4f, 0x5c, 0xbc, 0x31, 0x3a, 0x74, 0x75, 0x32, 0x37, 0x3a, 0x32, 0x30, 0x31, + 0x38, 0x2d, 0x31, 0x31, 0x2d, 0x32, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, + 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x31, 0x3a, 0x75, 0x6c, + 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, 0x2a, 0x4a, 0x9b, 0xfc, + 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x65, 0x65, 0x65, 0x65, }; Block> actual = Block>.Deserialize(encoded); @@ -225,7 +207,7 @@ DumbAction MakeAction(Address address, char identifier) => 0, _fx.TxFixture.PrivateKey2, new[] { MakeAction(addresses[2], 'C') }, - timestamp: DateTimeOffset.MinValue.AddSeconds(1) + timestamp: DateTimeOffset.MinValue.AddSeconds(2) ), }; Block blockIdx1 = MineNext(genesis, blockIdx1Txs, new byte[] { }); @@ -287,13 +269,13 @@ DumbAction MakeAction(Address address, char identifier) => 0, _fx.TxFixture.PrivateKey1, new[] { MakeAction(addresses[0], 'D') }, - timestamp: DateTimeOffset.MinValue.AddSeconds(7) + timestamp: DateTimeOffset.MinValue.AddSeconds(3) ), Transaction.Create( 0, _fx.TxFixture.PrivateKey2, new[] { MakeAction(addresses[3], 'E') }, - timestamp: DateTimeOffset.MinValue.AddSeconds(8) + timestamp: DateTimeOffset.MinValue.AddSeconds(4) ), Transaction.Create( 0, @@ -307,7 +289,7 @@ DumbAction MakeAction(Address address, char identifier) => recordRandom: true ), }, - timestamp: DateTimeOffset.MinValue.AddSeconds(9) + timestamp: DateTimeOffset.MinValue.AddSeconds(5) ), }; @@ -634,18 +616,18 @@ public void CanConvertToRaw() AssertBytesEqual( new byte[32] { - 0x7f, 0xa3, 0xae, 0x3f, 0x31, 0x7a, 0x7e, 0x64, 0xe9, 0xb9, 0x74, 0x9a, 0x6a, - 0xfb, 0xad, 0x21, 0x32, 0x20, 0x36, 0xda, 0x87, 0x2b, 0x8e, 0x44, 0xb7, 0xce, - 0x7c, 0x36, 0xb4, 0xa3, 0x0b, 0xce, + 0xc8, 0xa1, 0xad, 0x57, 0xd8, 0x88, 0x3a, 0xe1, 0xdc, 0x66, 0x7b, 0xbb, 0xc6, + 0xe8, 0xf7, 0x7d, 0x35, 0xf6, 0x2d, 0xaa, 0xfa, 0x3f, 0x07, 0x6b, 0x34, 0x02, + 0xc6, 0x17, 0x54, 0x22, 0xd8, 0xfb, }, rawHasText.Header.TxHash.ToArray() ); AssertBytesEqual( new byte[32] { - 0x5f, 0xaf, 0x15, 0x92, 0x49, 0x44, 0xe0, 0xe5, 0x67, 0x62, 0x97, 0xeb, 0x55, - 0x8d, 0xc7, 0x76, 0xe9, 0x03, 0x55, 0x42, 0xc4, 0xe6, 0x47, 0xe3, 0x84, 0x74, - 0x24, 0xa0, 0xdd, 0x60, 0xed, 0x4d, + 0xb5, 0x13, 0x2d, 0xe9, 0x3f, 0xa5, 0x78, 0x5a, 0x21, 0x3a, 0xcc, 0x2d, 0x6e, + 0xb5, 0x08, 0x14, 0xcd, 0xfe, 0x89, 0x77, 0x19, 0x70, 0x55, 0xf4, 0x03, 0xbc, + 0xc5, 0x6d, 0x91, 0x9d, 0x29, 0x01, }, rawHasText.Header.Hash.ToArray() ); @@ -681,19 +663,19 @@ public void BlockStructureSize() var codec = new Codec(); // Case of a block with no any txs. // Size of RawBlock - Assert.Equal(237, emptyBlock.Serialize().Length); + Assert.Equal(164, emptyBlock.Serialize().Length); // Size of BlockDigest - Assert.Equal(237, emptyBlock.ToBlockDigest().Serialize().Length); + Assert.Equal(164, emptyBlock.ToBlockDigest().Serialize().Length); // Size of BlockHeader - Assert.Equal(226, codec.Encode(emptyBlock.GetBlockHeader().ToBencodex()).Length); + Assert.Equal(159, codec.Encode(emptyBlock.GetBlockHeader().ToBencodex()).Length); // Case of a block with txs. // Size of RawBlock - Assert.Equal(791, txBlock.Serialize().Length); + Assert.Equal(615, txBlock.Serialize().Length); // Size of BlockDigest - Assert.Equal(362, txBlock.ToBlockDigest().Serialize().Length); + Assert.Equal(249, txBlock.ToBlockDigest().Serialize().Length); // Size of BlockHeader - Assert.Equal(295, codec.Encode(txBlock.GetBlockHeader().ToBencodex()).Length); + Assert.Equal(204, codec.Encode(txBlock.GetBlockHeader().ToBencodex()).Length); } } } diff --git a/Libplanet.Tests/Tx/TransactionTest.cs b/Libplanet.Tests/Tx/TransactionTest.cs index 8665384dd0..7858ef9533 100644 --- a/Libplanet.Tests/Tx/TransactionTest.cs +++ b/Libplanet.Tests/Tx/TransactionTest.cs @@ -67,12 +67,12 @@ public void Create() AssertBytesEqual( new byte[] { - 0x30, 0x45, 0x02, 0x21, 0x00, 0xcb, 0xcb, 0x8d, 0xed, 0x78, 0x80, 0x76, 0x3a, - 0xdb, 0x0e, 0x1f, 0x80, 0xd4, 0xf6, 0x21, 0x50, 0x0f, 0xde, 0x23, 0x8b, 0x6f, - 0xd8, 0xf5, 0x8b, 0xc8, 0xf2, 0x0a, 0x42, 0xd4, 0x4d, 0x43, 0x62, 0x02, 0x20, - 0x5f, 0xd7, 0x19, 0xed, 0x12, 0x61, 0x1b, 0xc3, 0x94, 0xae, 0x60, 0x3b, 0x35, - 0x53, 0xcc, 0xb2, 0xa8, 0x32, 0x19, 0xf9, 0x0d, 0xc7, 0xf0, 0xf1, 0xcd, 0xa8, - 0x6b, 0xf3, 0x7e, 0x51, 0x85, 0xbd, + 0x30, 0x44, 0x02, 0x20, 0x7f, 0x13, 0x86, 0x33, 0xb1, 0x2a, 0xff, 0x5c, 0xa0, + 0xb4, 0x03, 0xf7, 0x3f, 0xf4, 0x7b, 0xb0, 0x0c, 0x82, 0x16, 0x12, 0x95, 0x6c, + 0xc5, 0x45, 0xc9, 0x3d, 0x13, 0x73, 0x9e, 0xb8, 0xb9, 0x2a, 0x02, 0x20, 0x5a, + 0xb9, 0x78, 0x3e, 0xc6, 0x63, 0x17, 0x9c, 0x23, 0xce, 0xa5, 0x2e, 0x4f, 0x81, + 0x9e, 0xec, 0xca, 0x30, 0xaf, 0x98, 0x1f, 0x65, 0x86, 0xf9, 0x64, 0xe9, 0xe0, + 0x54, 0xb3, 0xa2, 0x3c, 0x6d, }, tx.Signature ); @@ -80,9 +80,9 @@ public void Create() new TxId( new byte[] { - 0x94, 0x48, 0x72, 0xec, 0xea, 0x57, 0x7a, 0x3e, 0xe1, 0x2f, 0xcd, 0x23, - 0xca, 0xb0, 0x0a, 0xad, 0xb6, 0xbe, 0x89, 0x14, 0xf9, 0x6b, 0x7e, 0xf1, - 0x30, 0x94, 0xe0, 0x28, 0xeb, 0x4a, 0x85, 0xb4, + 0xec, 0x3c, 0x4c, 0x03, 0xdd, 0x79, 0x8f, 0xb2, 0x9d, 0x77, 0xca, 0x4e, + 0xb1, 0x4a, 0x58, 0x40, 0x88, 0x22, 0x3a, 0x20, 0xc1, 0x67, 0xea, 0xe2, + 0xa1, 0xda, 0x25, 0x73, 0x2f, 0x61, 0x23, 0x25, } ), tx.Id @@ -203,11 +203,11 @@ public void MakeWithSignature() var timestamp = new DateTimeOffset(2018, 11, 21, 0, 0, 0, TimeSpan.Zero); var signature = new byte[] { - 0x30, 0x44, 0x02, 0x20, 0x5f, 0x43, 0x87, 0xfd, 0x72, 0xfe, 0x3a, 0x93, 0xd1, 0x34, - 0x65, 0xb3, 0x01, 0x47, 0x60, 0x0d, 0xa8, 0x48, 0xcc, 0x1d, 0xa4, 0xbd, 0x9b, 0x3a, - 0x05, 0x6a, 0x75, 0x40, 0x3c, 0xbe, 0xf4, 0x5a, 0x02, 0x20, 0x07, 0xb8, 0xa6, 0x3e, - 0x5f, 0x6c, 0xa9, 0xd4, 0x17, 0xc8, 0x40, 0x1c, 0xc5, 0xd2, 0xb7, 0x55, 0x26, 0x99, - 0x30, 0xd7, 0xdf, 0x77, 0x9f, 0x94, 0x25, 0xd3, 0xa2, 0xa1, 0xfa, 0x71, 0x8c, 0x7a, + 0x30, 0x44, 0x02, 0x20, 0x2f, 0x2d, 0xbe, 0x5a, 0x91, 0x65, 0x59, 0xde, 0xdb, 0xe8, + 0xd8, 0x4f, 0xa9, 0x20, 0xe2, 0x01, 0x29, 0x4d, 0x4f, 0x40, 0xea, 0x1e, 0x97, 0x44, + 0x1f, 0xbf, 0xa2, 0x5c, 0x8b, 0xd0, 0x0e, 0x23, 0x02, 0x20, 0x3c, 0x06, 0x02, 0x1f, + 0xb8, 0x3f, 0x67, 0x49, 0x92, 0x3c, 0x07, 0x59, 0x67, 0x96, 0xa8, 0x63, 0x04, 0xb0, + 0xc3, 0xfe, 0xbb, 0x6c, 0x7a, 0x7b, 0x58, 0x58, 0xe9, 0x7d, 0x37, 0x67, 0xe1, 0xe9, }; var tx = new Transaction( 0, @@ -234,9 +234,9 @@ public void MakeWithSignature() new TxId( new byte[] { - 0x3c, 0x82, 0x50, 0x29, 0x89, 0xe5, 0x8a, 0x0b, 0xfa, 0x66, 0x47, 0x09, - 0x99, 0xbc, 0xfd, 0xeb, 0xbd, 0x49, 0x3c, 0xbd, 0x3e, 0x1a, 0x74, 0x6b, - 0xc7, 0x1c, 0x86, 0x5b, 0x30, 0x1f, 0xde, 0xed, + 0xb0, 0x69, 0xfd, 0xe2, 0x53, 0x88, 0x53, 0xbe, 0x81, 0xb3, 0xea, 0xac, + 0xc2, 0x38, 0x55, 0x42, 0x0e, 0x03, 0xe5, 0x62, 0x6f, 0x75, 0x7f, 0xa1, + 0x9b, 0x37, 0x92, 0x60, 0x1a, 0x94, 0x88, 0x81, } ), tx.Id @@ -311,27 +311,23 @@ public void ToBencodex() { byte[] expected = { - 0x64, 0x75, 0x37, 0x3a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x6c, 0x65, 0x75, - 0x35, 0x3a, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x69, 0x30, 0x65, 0x75, 0x31, 0x30, 0x3a, - 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x36, 0x35, 0x3a, 0x04, - 0x46, 0x11, 0x5b, 0x01, 0x31, 0xba, 0xcc, 0xf9, 0x4a, 0x58, 0x56, 0xed, 0xe8, 0x71, - 0x29, 0x5f, 0x6f, 0x3d, 0x35, 0x2e, 0x68, 0x47, 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, - 0x09, 0xf7, 0x32, 0x80, 0x87, 0x11, 0xec, 0x97, 0xaf, 0x6e, 0x34, 0x1f, 0x11, 0x0a, - 0x32, 0x6d, 0xa1, 0xbd, 0xb8, 0x1f, 0x5a, 0xe3, 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, - 0xc8, 0xc4, 0x91, 0xae, 0xd3, 0xaa, 0xa2, 0x96, 0x75, 0x39, 0x3a, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x37, 0x30, 0x3a, 0x30, 0x44, 0x02, 0x20, 0x5f, - 0x43, 0x87, 0xfd, 0x72, 0xfe, 0x3a, 0x93, 0xd1, 0x34, 0x65, 0xb3, 0x01, 0x47, 0x60, - 0x0d, 0xa8, 0x48, 0xcc, 0x1d, 0xa4, 0xbd, 0x9b, 0x3a, 0x05, 0x6a, 0x75, 0x40, 0x3c, - 0xbe, 0xf4, 0x5a, 0x02, 0x20, 0x07, 0xb8, 0xa6, 0x3e, 0x5f, 0x6c, 0xa9, 0xd4, 0x17, - 0xc8, 0x40, 0x1c, 0xc5, 0xd2, 0xb7, 0x55, 0x26, 0x99, 0x30, 0xd7, 0xdf, 0x77, 0x9f, - 0x94, 0x25, 0xd3, 0xa2, 0xa1, 0xfa, 0x71, 0x8c, 0x7a, 0x75, 0x36, 0x3a, 0x73, 0x69, - 0x67, 0x6e, 0x65, 0x72, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, - 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x75, - 0x39, 0x3a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x75, 0x32, 0x37, - 0x3a, 0x32, 0x30, 0x31, 0x38, 0x2d, 0x31, 0x31, 0x2d, 0x32, 0x31, 0x54, 0x30, 0x30, - 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, - 0x75, 0x31, 0x37, 0x3a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x6c, 0x65, 0x65, + 0x64, 0x31, 0x3a, 0x53, 0x37, 0x30, 0x3a, 0x30, 0x44, 0x02, 0x20, 0x2f, 0x2d, 0xbe, + 0x5a, 0x91, 0x65, 0x59, 0xde, 0xdb, 0xe8, 0xd8, 0x4f, 0xa9, 0x20, 0xe2, 0x01, 0x29, + 0x4d, 0x4f, 0x40, 0xea, 0x1e, 0x97, 0x44, 0x1f, 0xbf, 0xa2, 0x5c, 0x8b, 0xd0, 0x0e, + 0x23, 0x02, 0x20, 0x3c, 0x06, 0x02, 0x1f, 0xb8, 0x3f, 0x67, 0x49, 0x92, 0x3c, 0x07, + 0x59, 0x67, 0x96, 0xa8, 0x63, 0x04, 0xb0, 0xc3, 0xfe, 0xbb, 0x6c, 0x7a, 0x7b, 0x58, + 0x58, 0xe9, 0x7d, 0x37, 0x67, 0xe1, 0xe9, 0x31, 0x3a, 0x61, 0x6c, 0x65, 0x31, 0x3a, + 0x6e, 0x69, 0x30, 0x65, 0x31, 0x3a, 0x70, 0x36, 0x35, 0x3a, 0x04, 0x46, 0x11, 0x5b, + 0x01, 0x31, 0xba, 0xcc, 0xf9, 0x4a, 0x58, 0x56, 0xed, 0xe8, 0x71, 0x29, 0x5f, 0x6f, + 0x3d, 0x35, 0x2e, 0x68, 0x47, 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, 0x09, 0xf7, 0x32, + 0x80, 0x87, 0x11, 0xec, 0x97, 0xaf, 0x6e, 0x34, 0x1f, 0x11, 0x0a, 0x32, 0x6d, 0xa1, + 0xbd, 0xb8, 0x1f, 0x5a, 0xe3, 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, 0xc8, 0xc4, 0x91, + 0xae, 0xd3, 0xaa, 0xa2, 0x96, 0x31, 0x3a, 0x73, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, + 0x14, 0x07, 0x3d, 0x66, 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, + 0x4f, 0x5c, 0xbc, 0x31, 0x3a, 0x74, 0x75, 0x32, 0x37, 0x3a, 0x32, 0x30, 0x31, 0x38, + 0x2d, 0x31, 0x31, 0x2d, 0x32, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, + 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x31, 0x3a, 0x75, 0x6c, 0x65, + 0x65, }; AssertBytesEqual(expected, _fx.Tx.Serialize(true)); @@ -342,40 +338,35 @@ public void ToBencodexWithActions() { var expected = new byte[] { - 0x64, 0x75, 0x37, 0x3a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x6c, 0x64, 0x75, - 0x37, 0x3a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x75, 0x36, 0x3a, 0x61, 0x74, - 0x74, 0x61, 0x63, 0x6b, 0x75, 0x36, 0x3a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x64, - 0x75, 0x36, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x75, 0x33, 0x3a, 0x6f, 0x72, - 0x63, 0x75, 0x31, 0x34, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, - 0x66, 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, - 0x75, 0x36, 0x3a, 0x77, 0x65, 0x61, 0x70, 0x6f, 0x6e, 0x75, 0x34, 0x3a, 0x77, 0x61, - 0x6e, 0x64, 0x65, 0x65, 0x64, 0x75, 0x37, 0x3a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, - 0x64, 0x75, 0x35, 0x3a, 0x73, 0x6c, 0x65, 0x65, 0x70, 0x75, 0x36, 0x3a, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x64, 0x75, 0x37, 0x3a, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x69, - 0x64, 0x69, 0x31, 0x30, 0x65, 0x65, 0x65, 0x65, 0x75, 0x35, 0x3a, 0x6e, 0x6f, 0x6e, - 0x63, 0x65, 0x69, 0x30, 0x65, 0x75, 0x31, 0x30, 0x3a, 0x70, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x36, 0x35, 0x3a, 0x04, 0x46, 0x11, 0x5b, 0x01, 0x31, - 0xba, 0xcc, 0xf9, 0x4a, 0x58, 0x56, 0xed, 0xe8, 0x71, 0x29, 0x5f, 0x6f, 0x3d, 0x35, - 0x2e, 0x68, 0x47, 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, 0x09, 0xf7, 0x32, 0x80, 0x87, - 0x11, 0xec, 0x97, 0xaf, 0x6e, 0x34, 0x1f, 0x11, 0x0a, 0x32, 0x6d, 0xa1, 0xbd, 0xb8, - 0x1f, 0x5a, 0xe3, 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, 0xc8, 0xc4, 0x91, 0xae, 0xd3, - 0xaa, 0xa2, 0x96, 0x75, 0x39, 0x3a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x37, 0x31, 0x3a, 0x30, 0x45, 0x02, 0x21, 0x00, 0xff, 0x59, 0xff, 0x0e, 0x5b, - 0x9e, 0xbf, 0xd7, 0xaf, 0xe6, 0x90, 0xed, 0x8c, 0xd4, 0xd7, 0xa1, 0x6a, 0xb2, 0xdf, - 0xc4, 0x42, 0x11, 0xea, 0x9e, 0xff, 0x73, 0xa6, 0x1f, 0x86, 0x4e, 0xf7, 0xde, 0x02, - 0x20, 0x51, 0x34, 0xd5, 0x55, 0xbf, 0x1a, 0x51, 0xcd, 0x45, 0x78, 0xda, 0x01, 0xb4, - 0x6b, 0xe9, 0x95, 0x85, 0x88, 0x4e, 0x21, 0x26, 0xc1, 0x52, 0x66, 0xfd, 0xb7, 0x5d, - 0xe2, 0x18, 0xb0, 0xd6, 0x2e, 0x75, 0x36, 0x3a, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, - 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, 0x2a, 0x4a, 0x9b, 0xfc, - 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x75, 0x39, 0x3a, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x75, 0x32, 0x37, 0x3a, 0x32, 0x30, 0x31, - 0x38, 0x2d, 0x31, 0x31, 0x2d, 0x32, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, - 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x75, 0x31, 0x37, 0x3a, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x6c, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, - 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x65, - 0x65, + 0x64, 0x31, 0x3a, 0x53, 0x37, 0x30, 0x3a, 0x30, 0x44, 0x02, 0x20, 0x4c, 0xf2, 0xd4, + 0xd9, 0x22, 0x97, 0xa6, 0x7f, 0xd0, 0x47, 0x69, 0xf2, 0x53, 0xe2, 0x0e, 0x62, 0x13, + 0xf0, 0x63, 0xb8, 0x14, 0x2f, 0xff, 0x4c, 0xb9, 0xe9, 0xc0, 0x47, 0x33, 0xed, 0xbc, + 0x16, 0x02, 0x20, 0x0e, 0xfe, 0xbb, 0x0e, 0x2a, 0x7b, 0xcf, 0x4d, 0x5c, 0x7a, 0x62, + 0x8e, 0xd2, 0xe7, 0xa9, 0x1f, 0x44, 0x0a, 0xfa, 0x31, 0x19, 0x7f, 0xf6, 0x16, 0xfb, + 0x32, 0xd8, 0xba, 0xda, 0xd3, 0xe9, 0xcc, 0x31, 0x3a, 0x61, 0x6c, 0x64, 0x75, 0x37, + 0x3a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x75, 0x36, 0x3a, 0x61, 0x74, 0x74, + 0x61, 0x63, 0x6b, 0x75, 0x36, 0x3a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x64, 0x75, + 0x36, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x75, 0x33, 0x3a, 0x6f, 0x72, 0x63, + 0x75, 0x31, 0x34, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, + 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x75, + 0x36, 0x3a, 0x77, 0x65, 0x61, 0x70, 0x6f, 0x6e, 0x75, 0x34, 0x3a, 0x77, 0x61, 0x6e, + 0x64, 0x65, 0x65, 0x64, 0x75, 0x37, 0x3a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x64, + 0x75, 0x35, 0x3a, 0x73, 0x6c, 0x65, 0x65, 0x70, 0x75, 0x36, 0x3a, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x64, 0x75, 0x37, 0x3a, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x69, 0x64, + 0x69, 0x31, 0x30, 0x65, 0x65, 0x65, 0x65, 0x31, 0x3a, 0x6e, 0x69, 0x30, 0x65, 0x31, + 0x3a, 0x70, 0x36, 0x35, 0x3a, 0x04, 0x46, 0x11, 0x5b, 0x01, 0x31, 0xba, 0xcc, 0xf9, + 0x4a, 0x58, 0x56, 0xed, 0xe8, 0x71, 0x29, 0x5f, 0x6f, 0x3d, 0x35, 0x2e, 0x68, 0x47, + 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, 0x09, 0xf7, 0x32, 0x80, 0x87, 0x11, 0xec, 0x97, + 0xaf, 0x6e, 0x34, 0x1f, 0x11, 0x0a, 0x32, 0x6d, 0xa1, 0xbd, 0xb8, 0x1f, 0x5a, 0xe3, + 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, 0xc8, 0xc4, 0x91, 0xae, 0xd3, 0xaa, 0xa2, 0x96, + 0x31, 0x3a, 0x73, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, 0x2a, + 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x31, 0x3a, + 0x74, 0x75, 0x32, 0x37, 0x3a, 0x32, 0x30, 0x31, 0x38, 0x2d, 0x31, 0x31, 0x2d, 0x32, + 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x5a, 0x31, 0x3a, 0x75, 0x6c, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, + 0x14, 0x07, 0x3d, 0x66, 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, + 0x4f, 0x5c, 0xbc, 0x65, 0x65, }; AssertBytesEqual(expected, _fx.TxWithActions.Serialize(true)); @@ -386,27 +377,23 @@ public void FromBencodex() { var bytes = new byte[] { - 0x64, 0x75, 0x37, 0x3a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x6c, 0x65, 0x75, - 0x35, 0x3a, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x69, 0x30, 0x65, 0x75, 0x31, 0x30, 0x3a, - 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x36, 0x35, 0x3a, 0x04, - 0x46, 0x11, 0x5b, 0x01, 0x31, 0xba, 0xcc, 0xf9, 0x4a, 0x58, 0x56, 0xed, 0xe8, 0x71, - 0x29, 0x5f, 0x6f, 0x3d, 0x35, 0x2e, 0x68, 0x47, 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, - 0x09, 0xf7, 0x32, 0x80, 0x87, 0x11, 0xec, 0x97, 0xaf, 0x6e, 0x34, 0x1f, 0x11, 0x0a, - 0x32, 0x6d, 0xa1, 0xbd, 0xb8, 0x1f, 0x5a, 0xe3, 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, - 0xc8, 0xc4, 0x91, 0xae, 0xd3, 0xaa, 0xa2, 0x96, 0x75, 0x39, 0x3a, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x37, 0x30, 0x3a, 0x30, 0x44, 0x02, 0x20, 0x5f, - 0x43, 0x87, 0xfd, 0x72, 0xfe, 0x3a, 0x93, 0xd1, 0x34, 0x65, 0xb3, 0x01, 0x47, 0x60, - 0x0d, 0xa8, 0x48, 0xcc, 0x1d, 0xa4, 0xbd, 0x9b, 0x3a, 0x05, 0x6a, 0x75, 0x40, 0x3c, - 0xbe, 0xf4, 0x5a, 0x02, 0x20, 0x07, 0xb8, 0xa6, 0x3e, 0x5f, 0x6c, 0xa9, 0xd4, 0x17, - 0xc8, 0x40, 0x1c, 0xc5, 0xd2, 0xb7, 0x55, 0x26, 0x99, 0x30, 0xd7, 0xdf, 0x77, 0x9f, - 0x94, 0x25, 0xd3, 0xa2, 0xa1, 0xfa, 0x71, 0x8c, 0x7a, 0x75, 0x36, 0x3a, 0x73, 0x69, - 0x67, 0x6e, 0x65, 0x72, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, - 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x75, - 0x39, 0x3a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x75, 0x32, 0x37, - 0x3a, 0x32, 0x30, 0x31, 0x38, 0x2d, 0x31, 0x31, 0x2d, 0x32, 0x31, 0x54, 0x30, 0x30, - 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, - 0x75, 0x31, 0x37, 0x3a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x6c, 0x65, 0x65, + 0x64, 0x31, 0x3a, 0x53, 0x37, 0x30, 0x3a, 0x30, 0x44, 0x02, 0x20, 0x2f, 0x2d, 0xbe, + 0x5a, 0x91, 0x65, 0x59, 0xde, 0xdb, 0xe8, 0xd8, 0x4f, 0xa9, 0x20, 0xe2, 0x01, 0x29, + 0x4d, 0x4f, 0x40, 0xea, 0x1e, 0x97, 0x44, 0x1f, 0xbf, 0xa2, 0x5c, 0x8b, 0xd0, 0x0e, + 0x23, 0x02, 0x20, 0x3c, 0x06, 0x02, 0x1f, 0xb8, 0x3f, 0x67, 0x49, 0x92, 0x3c, 0x07, + 0x59, 0x67, 0x96, 0xa8, 0x63, 0x04, 0xb0, 0xc3, 0xfe, 0xbb, 0x6c, 0x7a, 0x7b, 0x58, + 0x58, 0xe9, 0x7d, 0x37, 0x67, 0xe1, 0xe9, 0x31, 0x3a, 0x61, 0x6c, 0x65, 0x31, 0x3a, + 0x6e, 0x69, 0x30, 0x65, 0x31, 0x3a, 0x70, 0x36, 0x35, 0x3a, 0x04, 0x46, 0x11, 0x5b, + 0x01, 0x31, 0xba, 0xcc, 0xf9, 0x4a, 0x58, 0x56, 0xed, 0xe8, 0x71, 0x29, 0x5f, 0x6f, + 0x3d, 0x35, 0x2e, 0x68, 0x47, 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, 0x09, 0xf7, 0x32, + 0x80, 0x87, 0x11, 0xec, 0x97, 0xaf, 0x6e, 0x34, 0x1f, 0x11, 0x0a, 0x32, 0x6d, 0xa1, + 0xbd, 0xb8, 0x1f, 0x5a, 0xe3, 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, 0xc8, 0xc4, 0x91, + 0xae, 0xd3, 0xaa, 0xa2, 0x96, 0x31, 0x3a, 0x73, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, + 0x14, 0x07, 0x3d, 0x66, 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, + 0x4f, 0x5c, 0xbc, 0x31, 0x3a, 0x74, 0x75, 0x32, 0x37, 0x3a, 0x32, 0x30, 0x31, 0x38, + 0x2d, 0x31, 0x31, 0x2d, 0x32, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, + 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x31, 0x3a, 0x75, 0x6c, 0x65, + 0x65, }; PublicKey publicKey = new PrivateKey( new byte[] @@ -426,12 +413,12 @@ public void FromBencodex() AssertBytesEqual( new byte[] { - 0x30, 0x44, 0x02, 0x20, 0x5f, 0x43, 0x87, 0xfd, 0x72, 0xfe, 0x3a, 0x93, 0xd1, - 0x34, 0x65, 0xb3, 0x01, 0x47, 0x60, 0x0d, 0xa8, 0x48, 0xcc, 0x1d, 0xa4, 0xbd, - 0x9b, 0x3a, 0x05, 0x6a, 0x75, 0x40, 0x3c, 0xbe, 0xf4, 0x5a, 0x02, 0x20, 0x07, - 0xb8, 0xa6, 0x3e, 0x5f, 0x6c, 0xa9, 0xd4, 0x17, 0xc8, 0x40, 0x1c, 0xc5, 0xd2, - 0xb7, 0x55, 0x26, 0x99, 0x30, 0xd7, 0xdf, 0x77, 0x9f, 0x94, 0x25, 0xd3, 0xa2, - 0xa1, 0xfa, 0x71, 0x8c, 0x7a, + 0x30, 0x44, 0x02, 0x20, 0x2f, 0x2d, 0xbe, 0x5a, 0x91, 0x65, 0x59, 0xde, 0xdb, + 0xe8, 0xd8, 0x4f, 0xa9, 0x20, 0xe2, 0x01, 0x29, 0x4d, 0x4f, 0x40, 0xea, 0x1e, + 0x97, 0x44, 0x1f, 0xbf, 0xa2, 0x5c, 0x8b, 0xd0, 0x0e, 0x23, 0x02, 0x20, 0x3c, + 0x06, 0x02, 0x1f, 0xb8, 0x3f, 0x67, 0x49, 0x92, 0x3c, 0x07, 0x59, 0x67, 0x96, + 0xa8, 0x63, 0x04, 0xb0, 0xc3, 0xfe, 0xbb, 0x6c, 0x7a, 0x7b, 0x58, 0x58, 0xe9, + 0x7d, 0x37, 0x67, 0xe1, 0xe9, }, tx.Signature ); @@ -439,9 +426,9 @@ public void FromBencodex() new TxId( new byte[] { - 0x3c, 0x82, 0x50, 0x29, 0x89, 0xe5, 0x8a, 0x0b, 0xfa, 0x66, 0x47, 0x09, - 0x99, 0xbc, 0xfd, 0xeb, 0xbd, 0x49, 0x3c, 0xbd, 0x3e, 0x1a, 0x74, 0x6b, - 0xc7, 0x1c, 0x86, 0x5b, 0x30, 0x1f, 0xde, 0xed, + 0xb0, 0x69, 0xfd, 0xe2, 0x53, 0x88, 0x53, 0xbe, 0x81, 0xb3, 0xea, 0xac, + 0xc2, 0x38, 0x55, 0x42, 0x0e, 0x03, 0xe5, 0x62, 0x6f, 0x75, 0x7f, 0xa1, + 0x9b, 0x37, 0x92, 0x60, 0x1a, 0x94, 0x88, 0x81, } ), tx.Id @@ -453,40 +440,35 @@ public void FromBencodexWithActions() { var bytes = new byte[] { - 0x64, 0x75, 0x37, 0x3a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x6c, 0x64, 0x75, - 0x37, 0x3a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x75, 0x36, 0x3a, 0x61, 0x74, - 0x74, 0x61, 0x63, 0x6b, 0x75, 0x36, 0x3a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x64, - 0x75, 0x36, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x75, 0x33, 0x3a, 0x6f, 0x72, - 0x63, 0x75, 0x31, 0x34, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, - 0x66, 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, - 0x75, 0x36, 0x3a, 0x77, 0x65, 0x61, 0x70, 0x6f, 0x6e, 0x75, 0x34, 0x3a, 0x77, 0x61, - 0x6e, 0x64, 0x65, 0x65, 0x64, 0x75, 0x37, 0x3a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, - 0x64, 0x75, 0x35, 0x3a, 0x73, 0x6c, 0x65, 0x65, 0x70, 0x75, 0x36, 0x3a, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x64, 0x75, 0x37, 0x3a, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x69, - 0x64, 0x69, 0x31, 0x30, 0x65, 0x65, 0x65, 0x65, 0x75, 0x35, 0x3a, 0x6e, 0x6f, 0x6e, - 0x63, 0x65, 0x69, 0x30, 0x65, 0x75, 0x31, 0x30, 0x3a, 0x70, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x36, 0x35, 0x3a, 0x04, 0x46, 0x11, 0x5b, 0x01, 0x31, - 0xba, 0xcc, 0xf9, 0x4a, 0x58, 0x56, 0xed, 0xe8, 0x71, 0x29, 0x5f, 0x6f, 0x3d, 0x35, - 0x2e, 0x68, 0x47, 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, 0x09, 0xf7, 0x32, 0x80, 0x87, - 0x11, 0xec, 0x97, 0xaf, 0x6e, 0x34, 0x1f, 0x11, 0x0a, 0x32, 0x6d, 0xa1, 0xbd, 0xb8, - 0x1f, 0x5a, 0xe3, 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, 0xc8, 0xc4, 0x91, 0xae, 0xd3, - 0xaa, 0xa2, 0x96, 0x75, 0x39, 0x3a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x37, 0x31, 0x3a, 0x30, 0x45, 0x02, 0x21, 0x00, 0xff, 0x59, 0xff, 0x0e, 0x5b, - 0x9e, 0xbf, 0xd7, 0xaf, 0xe6, 0x90, 0xed, 0x8c, 0xd4, 0xd7, 0xa1, 0x6a, 0xb2, 0xdf, - 0xc4, 0x42, 0x11, 0xea, 0x9e, 0xff, 0x73, 0xa6, 0x1f, 0x86, 0x4e, 0xf7, 0xde, 0x02, - 0x20, 0x51, 0x34, 0xd5, 0x55, 0xbf, 0x1a, 0x51, 0xcd, 0x45, 0x78, 0xda, 0x01, 0xb4, - 0x6b, 0xe9, 0x95, 0x85, 0x88, 0x4e, 0x21, 0x26, 0xc1, 0x52, 0x66, 0xfd, 0xb7, 0x5d, - 0xe2, 0x18, 0xb0, 0xd6, 0x2e, 0x75, 0x36, 0x3a, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, - 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, 0x2a, 0x4a, 0x9b, 0xfc, - 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x75, 0x39, 0x3a, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x75, 0x32, 0x37, 0x3a, 0x32, 0x30, 0x31, - 0x38, 0x2d, 0x31, 0x31, 0x2d, 0x32, 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, - 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x75, 0x31, 0x37, 0x3a, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x6c, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, - 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x65, - 0x65, + 0x64, 0x31, 0x3a, 0x53, 0x37, 0x30, 0x3a, 0x30, 0x44, 0x02, 0x20, 0x4c, 0xf2, 0xd4, + 0xd9, 0x22, 0x97, 0xa6, 0x7f, 0xd0, 0x47, 0x69, 0xf2, 0x53, 0xe2, 0x0e, 0x62, 0x13, + 0xf0, 0x63, 0xb8, 0x14, 0x2f, 0xff, 0x4c, 0xb9, 0xe9, 0xc0, 0x47, 0x33, 0xed, 0xbc, + 0x16, 0x02, 0x20, 0x0e, 0xfe, 0xbb, 0x0e, 0x2a, 0x7b, 0xcf, 0x4d, 0x5c, 0x7a, 0x62, + 0x8e, 0xd2, 0xe7, 0xa9, 0x1f, 0x44, 0x0a, 0xfa, 0x31, 0x19, 0x7f, 0xf6, 0x16, 0xfb, + 0x32, 0xd8, 0xba, 0xda, 0xd3, 0xe9, 0xcc, 0x31, 0x3a, 0x61, 0x6c, 0x64, 0x75, 0x37, + 0x3a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x75, 0x36, 0x3a, 0x61, 0x74, 0x74, + 0x61, 0x63, 0x6b, 0x75, 0x36, 0x3a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x64, 0x75, + 0x36, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x75, 0x33, 0x3a, 0x6f, 0x72, 0x63, + 0x75, 0x31, 0x34, 0x3a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, + 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x75, + 0x36, 0x3a, 0x77, 0x65, 0x61, 0x70, 0x6f, 0x6e, 0x75, 0x34, 0x3a, 0x77, 0x61, 0x6e, + 0x64, 0x65, 0x65, 0x64, 0x75, 0x37, 0x3a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x69, 0x64, + 0x75, 0x35, 0x3a, 0x73, 0x6c, 0x65, 0x65, 0x70, 0x75, 0x36, 0x3a, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x64, 0x75, 0x37, 0x3a, 0x7a, 0x6f, 0x6e, 0x65, 0x5f, 0x69, 0x64, + 0x69, 0x31, 0x30, 0x65, 0x65, 0x65, 0x65, 0x31, 0x3a, 0x6e, 0x69, 0x30, 0x65, 0x31, + 0x3a, 0x70, 0x36, 0x35, 0x3a, 0x04, 0x46, 0x11, 0x5b, 0x01, 0x31, 0xba, 0xcc, 0xf9, + 0x4a, 0x58, 0x56, 0xed, 0xe8, 0x71, 0x29, 0x5f, 0x6f, 0x3d, 0x35, 0x2e, 0x68, 0x47, + 0xcd, 0xa9, 0xc0, 0x3e, 0x89, 0xfe, 0x09, 0xf7, 0x32, 0x80, 0x87, 0x11, 0xec, 0x97, + 0xaf, 0x6e, 0x34, 0x1f, 0x11, 0x0a, 0x32, 0x6d, 0xa1, 0xbd, 0xb8, 0x1f, 0x5a, 0xe3, + 0xba, 0xdf, 0x76, 0xa9, 0x0b, 0x22, 0xc8, 0xc4, 0x91, 0xae, 0xd3, 0xaa, 0xa2, 0x96, + 0x31, 0x3a, 0x73, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, 0x14, 0x07, 0x3d, 0x66, 0x2a, + 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, 0x4f, 0x5c, 0xbc, 0x31, 0x3a, + 0x74, 0x75, 0x32, 0x37, 0x3a, 0x32, 0x30, 0x31, 0x38, 0x2d, 0x31, 0x31, 0x2d, 0x32, + 0x31, 0x54, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x2e, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x5a, 0x31, 0x3a, 0x75, 0x6c, 0x32, 0x30, 0x3a, 0xc2, 0xa8, 0x60, + 0x14, 0x07, 0x3d, 0x66, 0x2a, 0x4a, 0x9b, 0xfc, 0xf9, 0xcb, 0x54, 0x26, 0x3d, 0xfa, + 0x4f, 0x5c, 0xbc, 0x65, 0x65, }; PublicKey publicKey = new PrivateKey( new byte[] @@ -510,12 +492,12 @@ public void FromBencodexWithActions() AssertBytesEqual( new byte[] { - 0x30, 0x45, 0x02, 0x21, 0x00, 0xff, 0x59, 0xff, 0x0e, 0x5b, 0x9e, 0xbf, 0xd7, - 0xaf, 0xe6, 0x90, 0xed, 0x8c, 0xd4, 0xd7, 0xa1, 0x6a, 0xb2, 0xdf, 0xc4, 0x42, - 0x11, 0xea, 0x9e, 0xff, 0x73, 0xa6, 0x1f, 0x86, 0x4e, 0xf7, 0xde, 0x02, 0x20, - 0x51, 0x34, 0xd5, 0x55, 0xbf, 0x1a, 0x51, 0xcd, 0x45, 0x78, 0xda, 0x01, 0xb4, - 0x6b, 0xe9, 0x95, 0x85, 0x88, 0x4e, 0x21, 0x26, 0xc1, 0x52, 0x66, 0xfd, 0xb7, - 0x5d, 0xe2, 0x18, 0xb0, 0xd6, 0x2e, + 0x30, 0x44, 0x02, 0x20, 0x4c, 0xf2, 0xd4, 0xd9, 0x22, 0x97, 0xa6, 0x7f, 0xd0, + 0x47, 0x69, 0xf2, 0x53, 0xe2, 0x0e, 0x62, 0x13, 0xf0, 0x63, 0xb8, 0x14, 0x2f, + 0xff, 0x4c, 0xb9, 0xe9, 0xc0, 0x47, 0x33, 0xed, 0xbc, 0x16, 0x02, 0x20, 0x0e, + 0xfe, 0xbb, 0x0e, 0x2a, 0x7b, 0xcf, 0x4d, 0x5c, 0x7a, 0x62, 0x8e, 0xd2, 0xe7, + 0xa9, 0x1f, 0x44, 0x0a, 0xfa, 0x31, 0x19, 0x7f, 0xf6, 0x16, 0xfb, 0x32, 0xd8, + 0xba, 0xda, 0xd3, 0xe9, 0xcc, }, tx.Signature ); @@ -523,9 +505,9 @@ public void FromBencodexWithActions() new TxId( new byte[] { - 0xf0, 0x50, 0x3d, 0x0f, 0x71, 0x7b, 0x00, 0x6c, 0x41, 0x70, 0xba, 0x8f, - 0x3f, 0x98, 0x61, 0x33, 0x32, 0xed, 0x18, 0x3d, 0x9d, 0x72, 0x7b, 0xc4, - 0xe2, 0x9a, 0xc2, 0x1c, 0xbe, 0x27, 0xe4, 0x03, + 0x2c, 0x7d, 0x15, 0xf4, 0xc1, 0xd5, 0x36, 0xce, 0x4c, 0xa2, 0xa3, 0x59, + 0xbc, 0xd8, 0x73, 0xa9, 0x4f, 0x3c, 0x65, 0x18, 0x10, 0x9f, 0xfa, 0xbc, + 0xf8, 0x7e, 0x34, 0x85, 0xf3, 0x63, 0xa5, 0x34, } ), tx.Id @@ -912,11 +894,11 @@ internal RawTransaction GetExpectedRawTransaction(bool includeSingature) byte[] signature = { - 0x30, 0x44, 0x02, 0x20, 0x5f, 0x43, 0x87, 0xfd, 0x72, 0xfe, 0x3a, 0x93, 0xd1, 0x34, - 0x65, 0xb3, 0x01, 0x47, 0x60, 0x0d, 0xa8, 0x48, 0xcc, 0x1d, 0xa4, 0xbd, 0x9b, 0x3a, - 0x05, 0x6a, 0x75, 0x40, 0x3c, 0xbe, 0xf4, 0x5a, 0x02, 0x20, 0x07, 0xb8, 0xa6, 0x3e, - 0x5f, 0x6c, 0xa9, 0xd4, 0x17, 0xc8, 0x40, 0x1c, 0xc5, 0xd2, 0xb7, 0x55, 0x26, 0x99, - 0x30, 0xd7, 0xdf, 0x77, 0x9f, 0x94, 0x25, 0xd3, 0xa2, 0xa1, 0xfa, 0x71, 0x8c, 0x7a, + 0x30, 0x44, 0x02, 0x20, 0x2f, 0x2d, 0xbe, 0x5a, 0x91, 0x65, 0x59, 0xde, 0xdb, 0xe8, + 0xd8, 0x4f, 0xa9, 0x20, 0xe2, 0x01, 0x29, 0x4d, 0x4f, 0x40, 0xea, 0x1e, 0x97, 0x44, + 0x1f, 0xbf, 0xa2, 0x5c, 0x8b, 0xd0, 0x0e, 0x23, 0x02, 0x20, 0x3c, 0x06, 0x02, 0x1f, + 0xb8, 0x3f, 0x67, 0x49, 0x92, 0x3c, 0x07, 0x59, 0x67, 0x96, 0xa8, 0x63, 0x04, 0xb0, + 0xc3, 0xfe, 0xbb, 0x6c, 0x7a, 0x7b, 0x58, 0x58, 0xe9, 0x7d, 0x37, 0x67, 0xe1, 0xe9, }; return tx.AddSignature(signature); } diff --git a/Libplanet/Blocks/BlockDigest.cs b/Libplanet/Blocks/BlockDigest.cs index c533480811..827f661c20 100644 --- a/Libplanet/Blocks/BlockDigest.cs +++ b/Libplanet/Blocks/BlockDigest.cs @@ -11,6 +11,10 @@ namespace Libplanet.Blocks /// internal readonly struct BlockDigest { + public static readonly byte[] HeaderKey = { 0x48 }; // 'H' + + public static readonly byte[] TransactionIdsKey = { 0x54 }; // 'T' + public BlockDigest(BlockHeader header, ImmutableArray> txIds) { Header = header; @@ -19,9 +23,9 @@ public BlockDigest(BlockHeader header, ImmutableArray> txId public BlockDigest(Bencodex.Types.Dictionary dict) { - Header = new BlockHeader(dict.GetValue("header")); - TxIds = dict.ContainsKey((Text)"transaction_ids") - ? dict.GetValue("transaction_ids") + Header = new BlockHeader(dict.GetValue(HeaderKey)); + TxIds = dict.ContainsKey((Binary)TransactionIdsKey) + ? dict.GetValue(TransactionIdsKey) .Select(txId => ((Binary)txId).ToImmutableArray()).ToImmutableArray() : ImmutableArray>.Empty; } @@ -51,12 +55,12 @@ public byte[] Serialize() public Bencodex.Types.Dictionary ToBencodex() { var dict = Bencodex.Types.Dictionary.Empty - .Add("header", Header.ToBencodex()); + .Add(HeaderKey, Header.ToBencodex()); if (TxIds.Any()) { dict = dict.Add( - "transaction_ids", + TransactionIdsKey, TxIds.Select(txId => (IValue)(Binary)txId.ToArray())); } diff --git a/Libplanet/Blocks/BlockHeader.cs b/Libplanet/Blocks/BlockHeader.cs index 5274dbf944..82f4426269 100644 --- a/Libplanet/Blocks/BlockHeader.cs +++ b/Libplanet/Blocks/BlockHeader.cs @@ -6,6 +6,22 @@ namespace Libplanet.Blocks { internal readonly struct BlockHeader { + public static readonly byte[] IndexKey = { 0x69 }; // 'i' + + public static readonly byte[] TimestampKey = { 0x74 }; // 't' + + public static readonly byte[] DifficultyKey = { 0x64 }; // 'd' + + public static readonly byte[] NonceKey = { 0x6e }; // 'n' + + public static readonly byte[] MinerKey = { 0x6d }; // 'm' + + public static readonly byte[] PreviousHashKey = { 0x70 }; // 'p' + + public static readonly byte[] TxHashKey = { 0x78 }; // 'x' + + public static readonly byte[] HashKey = { 0x68 }; // 'h' + public BlockHeader( long index, string timestamp, @@ -28,25 +44,25 @@ public BlockHeader( public BlockHeader(Bencodex.Types.Dictionary dict) { - Index = dict.GetValue("index"); - Timestamp = dict.GetValue("timestamp"); - Difficulty = dict.GetValue("difficulty"); - Nonce = dict.GetValue("nonce").ToImmutableArray(); + Index = dict.GetValue(IndexKey); + Timestamp = dict.GetValue(TimestampKey); + Difficulty = dict.GetValue(DifficultyKey); + Nonce = dict.GetValue(NonceKey).ToImmutableArray(); - Miner = dict.ContainsKey((Text)"reward_beneficiary") - ? dict.GetValue("reward_beneficiary").ToImmutableArray() + Miner = dict.ContainsKey((Binary)MinerKey) + ? dict.GetValue(MinerKey).ToImmutableArray() : ImmutableArray.Empty; - PreviousHash = dict.ContainsKey((Text)"previous_hash") - ? dict.GetValue("previous_hash").ToImmutableArray() + PreviousHash = dict.ContainsKey((Binary)PreviousHashKey) + ? dict.GetValue(PreviousHashKey).ToImmutableArray() : ImmutableArray.Empty; - TxHash = dict.ContainsKey((Text)"transaction_fingerprint") - ? dict.GetValue("transaction_fingerprint").ToImmutableArray() + TxHash = dict.ContainsKey((Binary)TxHashKey) + ? dict.GetValue(TxHashKey).ToImmutableArray() : ImmutableArray.Empty; - Hash = dict.ContainsKey((Text)"hash") - ? dict.GetValue("hash").ToImmutableArray() + Hash = dict.ContainsKey((Binary)HashKey) + ? dict.GetValue(HashKey).ToImmutableArray() : ImmutableArray.Empty; } @@ -69,25 +85,25 @@ public BlockHeader(Bencodex.Types.Dictionary dict) public Bencodex.Types.Dictionary ToBencodex() { var dict = Bencodex.Types.Dictionary.Empty - .Add("index", Index) - .Add("timestamp", Timestamp) - .Add("difficulty", Difficulty) - .Add("nonce", Nonce.ToArray()) - .Add("hash", Hash.ToArray()); + .Add(IndexKey, Index) + .Add(TimestampKey, Timestamp) + .Add(DifficultyKey, Difficulty) + .Add(NonceKey, Nonce.ToArray()) + .Add(HashKey, Hash.ToArray()); if (Miner.Any()) { - dict = dict.Add("reward_beneficiary", Miner.ToArray()); + dict = dict.Add(MinerKey, Miner.ToArray()); } if (PreviousHash.Any()) { - dict = dict.Add("previous_hash", PreviousHash.ToArray()); + dict = dict.Add(PreviousHashKey, PreviousHash.ToArray()); } if (TxHash.Any()) { - dict = dict.Add("transaction_fingerprint", TxHash.ToArray()); + dict = dict.Add(TxHashKey, TxHash.ToArray()); } return dict; diff --git a/Libplanet/Blocks/RawBlock.cs b/Libplanet/Blocks/RawBlock.cs index 97189f67a9..4f61a28ec9 100644 --- a/Libplanet/Blocks/RawBlock.cs +++ b/Libplanet/Blocks/RawBlock.cs @@ -6,9 +6,9 @@ namespace Libplanet.Blocks { internal readonly struct RawBlock { - public const string HeaderKey = "header"; + public static readonly byte[] HeaderKey = { 0x48 }; // 'H' - public const string TransactionsKey = "transactions"; + public static readonly byte[] TransactionsKey = { 0x54 }; // 'T' public RawBlock( BlockHeader header, @@ -21,7 +21,7 @@ public RawBlock( public RawBlock(Bencodex.Types.Dictionary dict) { Header = new BlockHeader(dict.GetValue(HeaderKey)); - Transactions = dict.ContainsKey((Text)TransactionsKey) + Transactions = dict.ContainsKey((Binary)TransactionsKey) ? dict.GetValue(TransactionsKey) .Select(tx => ((Binary)tx).ToImmutableArray()).ToImmutableArray() : ImmutableArray>.Empty; diff --git a/Libplanet/Tx/RawTransaction.cs b/Libplanet/Tx/RawTransaction.cs index eadeda5005..b5a598971a 100644 --- a/Libplanet/Tx/RawTransaction.cs +++ b/Libplanet/Tx/RawTransaction.cs @@ -10,19 +10,19 @@ namespace Libplanet.Tx [Equals] internal readonly struct RawTransaction { - public const string NonceKey = "nonce"; + public static readonly byte[] NonceKey = { 0x6e }; // 'n' - public const string SignerKey = "signer"; + public static readonly byte[] SignerKey = { 0x73 }; // 's' - public const string UpdatedAddressesKey = "updated_addresses"; + public static readonly byte[] UpdatedAddressesKey = { 0x75 }; // 'u' - public const string PublicKeyKey = "public_key"; + public static readonly byte[] PublicKeyKey = { 0x70 }; // 'p' - public const string TimestampKey = "timestamp"; + public static readonly byte[] TimestampKey = { 0x74 }; // 't' - public const string ActionsKey = "actions"; + public static readonly byte[] ActionsKey = { 0x61 }; // 'a' - public const string SignatureKey = "signature"; + public static readonly byte[] SignatureKey = { 0x53 }; // 'S' public RawTransaction( long nonce, @@ -73,7 +73,7 @@ public RawTransaction(Bencodex.Types.Dictionary dict) Timestamp = dict.GetValue(TimestampKey); Actions = dict.GetValue(ActionsKey).ToImmutableArray(); - Signature = dict.ContainsKey((Text)SignatureKey) + Signature = dict.ContainsKey((Binary)SignatureKey) ? dict.GetValue(SignatureKey).ToImmutableArray() : ImmutableArray.Empty; }