var Transaction = require('ethereumjs-tx');
var _ = require('lodash');
var util = require('../util');

module.exports = {
  init: function(optionsOrRlp) {
    if (optionsOrRlp) {
      if (_.isString(optionsOrRlp)) {
        this.tx = new Transaction(util.toBuffer(optionsOrRlp));
        this.from = util.toHex(this.tx.getSenderAddress());
        this.to = this.tx.to.length > 0 ? util.toHex(this.tx.to) : null;
        this.nonce = util.toBigNumber(this.tx.nonce);
        this.gasLimit = util.toBigNumber(this.tx.gasLimit);
        this.gasPrice = util.toBigNumber(this.tx.gasPrice);
        this.value = util.toBigNumber(this.tx.value);
      } else
        _.assign(this, optionsOrRlp);
    }
    return this;
  },
  getTx: function() {
    if (this.tx) return this.tx;
    var tx = new Transaction({
      nonce: !this.nonce || this.nonce.isZero() ? null : this.nonce.toNumber(),
      gasPrice: this.gasPrice.toNumber(),
      gasLimit: this.gasLimit.toNumber(),
      to: this.to ? util.toBuffer(this.to) : null,
      value: !this.value || this.value.isZero() ? null : this.value.toNumber(),
      data: this.data ? util.toBuffer(this.data) : null
    });
    tx.sign(util.toBuffer(this.pkey));
    return tx;
  }
};

@@ -631,24 +631,103 @@
 .tx.value);%0A
+        this.data = this.tx.data.length %3E 0 ? util.toHex(this.tx.data) : null;%0A
       %7D else

Fix the bug with data field parsing