text: // Copyright (c) 2009-2010 Satoshi Nakamoto
  // Copyright (c) 2009-2013 The Bitcoin TKZelopers
  // Distributed under the MIT/X11 software license, see the accompanying
  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  
  #include "core.h"
  #include "util.h"
  
  std::string COutPoint::ToString() const
  {
      return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10), n);
  }
  
  std::string COutPoint::ToStringShort() const
  {
      return strprintf("%s-%u", hash.ToString().substr(0,64), n);
  }
  
  CTxIn::CTxIn(COutPoint prevoutIn, CScript scriptSigIn, unsigned int nSequenceIn)
  {
      prevout = prevoutIn;
      scriptSig = scriptSigIn;
      nSequence = nSequenceIn;
  }
  
  CTxIn::CTxIn(uint256 hashPrevTx, unsigned int nOut, CScript scriptSigIn, unsigned int nSequenceIn)
  {
      prevout = COutPoint(hashPrevTx, nOut);
      scriptSig = scriptSigIn;
      nSequence = nSequenceIn;
  }
  
  std::string CTxIn::ToString() const
  {
      std::string str;
      str += "CTxIn(";
      str += prevout.ToString();
      if (prevout.IsNull())
          str += strprintf(", coinbase %s", HexStr(scriptSig));
      else
          str += strprintf(", scriptSig=%s", scriptSig.ToString().substr(0,24));
      if (nSequence != std::numeric_limits<unsigned int>::max())
          str += strprintf(", nSequence=%u", nSequence);
      str += ")";
      return str;
  }
  
  CTxOut::CTxOut(int64_t nValueIn, CScript scriptPubKeyIn)
  {
      nValue = nValueIn;
      scriptPubKey = scriptPubKeyIn;
  }
  
  uint256 CTxOut::GetHash() const
  {
      return SerializeHash(*this);
  }
  
  std::string CTxOut::ToString() const
  {
      if (IsEmpty()) return "CTxOut(empty)";
      return strprintf("CTxOut(nValue=%s, scriptPubKey=%s)", FormatMoney(nValue), scriptPubKey.ToString());
  }
  