From bb8f06c248e416e994daba2508da276e08fa08a8 Mon Sep 17 00:00:00 2001 From: ricmoo Date: Tue, 4 Apr 2017 18:23:31 -0400 Subject: [PATCH] If raw is missing from a transaction, compute it. --- providers/provider.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/providers/provider.js b/providers/provider.js index f4aabef34..ef7abda62 100644 --- a/providers/provider.js +++ b/providers/provider.js @@ -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;