You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
53 lines
1.4 KiB
12 years ago
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||
|
// Copyright (c) 2009-2013 The Bitcoin developers
|
||
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||
|
#ifndef BITCOIN_CORE_H
|
||
|
#define BITCOIN_CORE_H
|
||
|
|
||
|
#include "uint256.h"
|
||
|
#include "serialize.h"
|
||
|
#include "util.h"
|
||
|
|
||
|
#include <stdio.h>
|
||
|
|
||
|
/** An outpoint - a combination of a transaction hash and an index n into its vout */
|
||
|
class COutPoint
|
||
|
{
|
||
|
public:
|
||
|
uint256 hash;
|
||
|
unsigned int n;
|
||
|
|
||
|
COutPoint() { SetNull(); }
|
||
|
COutPoint(uint256 hashIn, unsigned int nIn) { hash = hashIn; n = nIn; }
|
||
|
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
|
||
|
void SetNull() { hash = 0; n = (unsigned int) -1; }
|
||
|
bool IsNull() const { return (hash == 0 && n == (unsigned int) -1); }
|
||
|
|
||
|
friend bool operator<(const COutPoint& a, const COutPoint& b)
|
||
|
{
|
||
|
return (a.hash < b.hash || (a.hash == b.hash && a.n < b.n));
|
||
|
}
|
||
|
|
||
|
friend bool operator==(const COutPoint& a, const COutPoint& b)
|
||
|
{
|
||
|
return (a.hash == b.hash && a.n == b.n);
|
||
|
}
|
||
|
|
||
|
friend bool operator!=(const COutPoint& a, const COutPoint& b)
|
||
|
{
|
||
|
return !(a == b);
|
||
|
}
|
||
|
|
||
|
std::string ToString() const
|
||
|
{
|
||
|
return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10).c_str(), n);
|
||
|
}
|
||
|
|
||
|
void print() const
|
||
|
{
|
||
|
printf("%s\n", ToString().c_str());
|
||
|
}
|
||
|
};
|
||
|
|
||
|
#endif
|