Browse Source

Created core.h/core.cpp, added to makefiles. Started moving core structures from main to core beginning with COutPoint.

pull/1/head
Eric Lombrozo 10 years ago
parent
commit
effc2770f5
  1. 2
      bitcoin-qt.pro
  2. 6
      src/core.cpp
  3. 53
      src/core.h
  4. 42
      src/main.h
  5. 1
      src/makefile.linux-mingw
  6. 1
      src/makefile.mingw
  7. 1
      src/makefile.osx
  8. 1
      src/makefile.unix

2
bitcoin-qt.pro

@ -154,6 +154,7 @@ HEADERS += src/qt/bitcoingui.h \ @@ -154,6 +154,7 @@ HEADERS += src/qt/bitcoingui.h \
src/hash.h \
src/uint256.h \
src/serialize.h \
src/core.h \
src/main.h \
src/net.h \
src/key.h \
@ -234,6 +235,7 @@ SOURCES += src/qt/bitcoin.cpp \ @@ -234,6 +235,7 @@ SOURCES += src/qt/bitcoin.cpp \
src/netbase.cpp \
src/key.cpp \
src/script.cpp \
src/core.cpp \
src/main.cpp \
src/init.cpp \
src/net.cpp \

6
src/core.cpp

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
// 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.
#include "core.h"

53
src/core.h

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
// 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

42
src/main.h

@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
#ifndef BITCOIN_MAIN_H
#define BITCOIN_MAIN_H
#include "core.h"
#include "bignum.h"
#include "sync.h"
#include "net.h"
@ -267,47 +268,6 @@ public: @@ -267,47 +268,6 @@ public:
/** 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().c_str(), n);
}
void print() const
{
printf("%s\n", ToString().c_str());
}
};
/** An input of a transaction. It contains the location of the previous
* transaction's output that it claims and a signature that matches the

1
src/makefile.linux-mingw

@ -73,6 +73,7 @@ OBJS= \ @@ -73,6 +73,7 @@ OBJS= \
obj/init.o \
obj/bitcoind.o \
obj/keystore.o \
obj/core.o \
obj/main.o \
obj/net.o \
obj/protocol.o \

1
src/makefile.mingw

@ -81,6 +81,7 @@ OBJS= \ @@ -81,6 +81,7 @@ OBJS= \
obj/init.o \
obj/bitcoind.o \
obj/keystore.o \
obj/core.o \
obj/main.o \
obj/net.o \
obj/protocol.o \

1
src/makefile.osx vendored

@ -84,6 +84,7 @@ OBJS= \ @@ -84,6 +84,7 @@ OBJS= \
obj/init.o \
obj/bitcoind.o \
obj/keystore.o \
obj/core.o \
obj/main.o \
obj/net.o \
obj/protocol.o \

1
src/makefile.unix

@ -123,6 +123,7 @@ OBJS= \ @@ -123,6 +123,7 @@ OBJS= \
obj/init.o \
obj/bitcoind.o \
obj/keystore.o \
obj/core.o \
obj/main.o \
obj/net.o \
obj/protocol.o \

Loading…
Cancel
Save