Browse Source

transaction address length test fix

cl-refactor
winsvega 10 years ago
parent
commit
0d7a4a929d
  1. 4
      test/transaction.cpp
  2. 34
      test/ttTransactionTestFiller.json

4
test/transaction.cpp

@ -21,7 +21,6 @@
*/
#include "TestHelper.h"
using namespace std;
using namespace json_spirit;
using namespace dev;
@ -152,6 +151,9 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
if (!txFromFields.signature().isValid())
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") );
//cause Address is length20 array, when trying to create address from sting of another length, field "to" would be diffrent from RLP encoded Address
BOOST_CHECK_MESSAGE(Address(tObj["to"].get_str()) == txFromFields.receiveAddress(), "seems that transaction 'to' address has wrong format");
o["sender"] = toString(txFromFields.sender());
}
catch(...)

34
test/ttTransactionTestFiller.json

@ -242,44 +242,14 @@
}
},
"AddressMore20" : {
"WrongAddress" : {
"transaction" :
{
"data" : "",
"gasLimit" : "",
"gasPrice" : "",
"nonce" : "",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d871f",
"value" : "",
"v" : "27",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
}
},
"AddressLess20" : {
"transaction" :
{
"data" : "",
"gasLimit" : "",
"gasPrice" : "",
"nonce" : "",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d",
"value" : "",
"v" : "27",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
}
},
"AddressMore20WithFirstZeros" : {
"transaction" :
{
"data" : "",
"gasLimit" : "",
"gasPrice" : "",
"nonce" : "",
"to" : "0x00000000000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d8v",
"value" : "",
"v" : "27",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",

Loading…
Cancel
Save