If raw is missing from a transaction, compute it.

This commit is contained in:
ricmoo 2017-04-04 18:23:31 -04:00
parent cb9bfccb9a
commit bb8f06c248

@ -29,7 +29,6 @@ function check(format, object) {
var value = format[key](object[key]);
if (value !== undefined) { result[key] = value; }
} catch (error) {
console.log(error, key, object);
error.checkKey = key;
error.checkValue = object[key];
throw error;
@ -184,6 +183,23 @@ function checkTransaction(transaction) {
transaction.creates = utils.getContractAddress(transaction);
}
if (!transaction.raw) {
var raw = [
utils.hexlify(transaction.nonce),
utils.hexlify(transaction.gasPrice),
utils.hexlify(transaction.gasLimit),
(transaction.to || "0x"),
utils.hexlify(transaction.value || '0x'),
utils.hexlify(transaction.data || '0x'),
utils.hexlify(transaction.v || '0x'),
utils.hexlify(transaction.r),
utils.hexlify(transaction.s),
];
transaction.raw = utils.RLP.encode(raw);
}
var result = check(formatTransaction, transaction);
var networkId = transaction.networkId;