message: src/script/script.h: endian compatibility for PUSHDATA sizes
  backports bitcoin@4e853aa163ddb978d25bd8b8ecfd730a1d09e051
diff: #include <string>
  #include <vector>
  +#include "crypto/common.h"
  +
  typedef std::vector<unsigned char> valtype;
  static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
  @@ -436,14 +438,16 @@ public:
  else if (b.size() <= 0xffff)
  {
  insert(end(), OP_PUSHDATA2);
  - unsigned short nSize = b.size();
  - insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
  + uint8_t data[2];
  + WriteLE16(data, b.size());
  + insert(end(), data, data + sizeof(data));
  }
  else
  {
  insert(end(), OP_PUSHDATA4);
  - unsigned int nSize = b.size();
  - insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
  + uint8_t data[4];
  + WriteLE32(data, b.size());
  + insert(end(), data, data + sizeof(data));
  }
  insert(end(), b.begin(), b.end());
  return *this;
  @@ -522,15 +526,14 @@ public:
  {
  if (end() - pc < 2)
  return false;
  - nSize = 0;
  - memcpy(&nSize, &pc[0], 2);
  + nSize = ReadLE16(&pc[0]);
  pc += 2;
  }
  else if (opcode == OP_PUSHDATA4)
  {
  if (end() - pc < 4)
  return false;
  - memcpy(&nSize, &pc[0], 4);
  + nSize = ReadLE32(&pc[0]);
  pc += 4;
  }
  if (end() - pc < 0 || (unsigned int)(end() - pc) < nSize)
  