message: Avoid code duplication in the definition of "<<" operator
diff: @@ -374,7 +374,6 @@ public:
  explicit LegacyCScriptNum(const int64_t &n) : CScriptNum(n) {}
  };
  -
  /**
  * We use a prevector for the script to reduce the considerable memory overhead
  * of vectors in cases where they normally contain a small number of small elements.
  @@ -445,10 +444,8 @@ public:
  return *this;
  }
  - CScript &operator<<(const LegacyCScriptNum &a)
  + void serializeVector(const std::vector<unsigned char> &b)
  {
  - auto b = a.getvch();
  -
  if (b.size() < OP_PUSHDATA1)
  {
  insert(end(), (unsigned char)b.size());
  @@ -473,6 +470,12 @@ public:
  insert(end(), data, data + sizeof(data));
  }
  insert(end(), b.begin(), b.end());
  + }
  +
  + CScript &operator<<(const LegacyCScriptNum &a)
  + {
  + auto b = a.getvch();
  + serializeVector(b);
  return *this;
  }
  @@ -493,30 +496,8 @@ public:
  insert(end(), OP_1NEGATE);
  return *this;
  }
  - else if (b.size() < OP_PUSHDATA1)
  - {
  - insert(end(), (unsigned char)b.size());
  - }
  - else if (b.size() <= 0xff)
  - {
  - insert(end(), OP_PUSHDATA1);
  - insert(end(), (unsigned char)b.size());
  - }
  - else if (b.size() <= 0xffff)
  - {
  - insert(end(), OP_PUSHDATA2);
  - uint8_t data[2];
  - WriteLE16(data, b.size());
  - insert(end(), data, data + sizeof(data));
  - }
  - else
  - {
  - insert(end(), OP_PUSHDATA4);
  - uint8_t data[4];
  - WriteLE32(data, b.size());
  - insert(end(), data, data + sizeof(data));
  - }
  - insert(end(), b.begin(), b.end());
  +
  + serializeVector(b);
  return *this;
  }
  