diff options
author | Eric Lombrozo <elombrozo@gmail.com> | 2013-01-08 03:02:51 -0800 |
---|---|---|
committer | Eric Lombrozo <elombrozo@gmail.com> | 2013-06-05 23:14:52 -0700 |
commit | effc2770f50554416e7d7b27f5c5b5cef9489440 (patch) | |
tree | 353bbbdc57b6d8fcb24b74b83945f031db842c32 /src | |
parent | 663224c2324d64134f8587fe77d1d787c0353b20 (diff) |
Created core.h/core.cpp, added to makefiles. Started moving core structures from main to core beginning with COutPoint.
Diffstat (limited to 'src')
-rw-r--r-- | src/core.cpp | 6 | ||||
-rw-r--r-- | src/core.h | 53 | ||||
-rw-r--r-- | src/main.h | 42 | ||||
-rw-r--r-- | src/makefile.linux-mingw | 1 | ||||
-rw-r--r-- | src/makefile.mingw | 1 | ||||
-rw-r--r-- | src/makefile.osx | 1 | ||||
-rw-r--r-- | src/makefile.unix | 1 |
7 files changed, 64 insertions, 41 deletions
diff --git a/src/core.cpp b/src/core.cpp new file mode 100644 index 0000000000..cb1053b69d --- /dev/null +++ b/src/core.cpp @@ -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"
\ No newline at end of file diff --git a/src/core.h b/src/core.h new file mode 100644 index 0000000000..77bd8472ed --- /dev/null +++ b/src/core.h @@ -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
\ No newline at end of file diff --git a/src/main.h b/src/main.h index feaa10318c..099e436d9e 100644 --- a/src/main.h +++ b/src/main.h @@ -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: -/** 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 diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index 114a9491bd..9cfab5942a 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -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 \ diff --git a/src/makefile.mingw b/src/makefile.mingw index 34ddc3eece..33cc7e6b4a 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -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 \ diff --git a/src/makefile.osx b/src/makefile.osx index 4ee0edcb95..bef0ef3518 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -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 \ diff --git a/src/makefile.unix b/src/makefile.unix index f8042b2930..a83bab1047 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -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 \ |