Skip to content

Commit

Permalink
Fixing bitcoin API change problems due to PR merges part #1
Browse files Browse the repository at this point in the history
  • Loading branch information
psolstice committed Mar 15, 2020
1 parent d096799 commit 36ce197
Show file tree
Hide file tree
Showing 22 changed files with 1,596 additions and 798 deletions.
4 changes: 2 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ endif

# wallet: shared between zcoind and zcoin-qt, but only linked
# when wallet enabled
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(DEPENDENCIES_INCLUDES)
libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_wallet_a_SOURCES = \
activeznode.cpp \
Expand Down Expand Up @@ -506,7 +506,7 @@ libbitcoin_common_a_SOURCES = \
# util: shared between all executables.
# This library *must* be included to make sure that the glibc
# backward-compatibility objects and their sanity checks are linked.
libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(DEPENDENCIES_INCLUDES)
libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_util_a_SOURCES = \
bls/bls_batchverifier.h \
Expand Down
5 changes: 3 additions & 2 deletions src/activeznode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "znode-payments.h"
#include "znodeman.h"
#include "protocol.h"
#include "netbase.h"

// TODO: upgrade to new dash, remove this hack
#define vNodes (g_connman->vNodes)
Expand Down Expand Up @@ -161,8 +162,8 @@ void CActiveZnode::ManageStateInitial() {
if(Params().NetworkIDString() == CBaseChainParams::REGTEST) {
std::string const & serv = GetArg("-externalip", "");
if(!serv.empty()) {
service = CService(serv.c_str());
fFoundLocal = true;
if (Lookup(serv.c_str(), service, 0, false))
fFoundLocal = true;
}

}
Expand Down
81 changes: 0 additions & 81 deletions src/coins.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,87 +100,6 @@ class SaltedOutpointHasher
}
};

/**
* A UTXO entry.
*
* Serialized format:
* - VARINT((coinbase ? 1 : 0) | (height << 1))
* - the non-spent CTxOut (via CTxOutCompressor)
*/
class Coin
{
public:
//! unspent transaction output
CTxOut out;

//! whether containing transaction was a coinbase
unsigned int fCoinBase : 1;

//! at which height this containing transaction was included in the active block chain
uint32_t nHeight : 31;

//! construct a Coin from a CTxOut and height/coinbase information.
Coin(CTxOut&& outIn, int nHeightIn, bool fCoinBaseIn) : out(std::move(outIn)), fCoinBase(fCoinBaseIn), nHeight(nHeightIn) {}
Coin(const CTxOut& outIn, int nHeightIn, bool fCoinBaseIn) : out(outIn), fCoinBase(fCoinBaseIn),nHeight(nHeightIn) {}

void Clear() {
out.SetNull();
fCoinBase = false;
nHeight = 0;
}

//! empty constructor
Coin() : fCoinBase(false), nHeight(0) { }

bool IsCoinBase() const {
return fCoinBase;
}

template<typename Stream>
void Serialize(Stream &s) const {
assert(!IsSpent());
uint32_t code = nHeight * 2 + fCoinBase;
::Serialize(s, VARINT(code));
::Serialize(s, CTxOutCompressor(REF(out)));
}

template<typename Stream>
void Unserialize(Stream &s) {
uint32_t code = 0;
::Unserialize(s, VARINT(code));
nHeight = code >> 1;
fCoinBase = code & 1;
::Unserialize(s, REF(CTxOutCompressor(out)));
}

bool IsSpent() const {
return out.IsNull();
}

size_t DynamicMemoryUsage() const {
return memusage::DynamicUsage(out.scriptPubKey);
}
};

class SaltedOutpointHasher
{
private:
/** Salt */
const uint64_t k0, k1;

public:
SaltedOutpointHasher();

/**
* This *must* return size_t. With Boost 1.46 on 32-bit systems the
* unordered_map will behave unpredictably if the custom hasher returns a
* uint64_t, resulting in failures when syncing the chain (#4634).
*/
size_t operator()(const COutPoint& id) const {
return SipHashUint256Extra(k0, k1, id.hash, id.n);
}
};

struct CCoinsCacheEntry
{
Coin coin; // The actual cached data.
Expand Down
2 changes: 1 addition & 1 deletion src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ struct Params {
int nInstantSendConfirmationsRequired; // in blocks
int nInstantSendKeepLock; // in blocks
int nInstantSendSigsRequired;

int nInstantSendSigsTotal;

/** Zerocoin-related block numbers when features are changed */
int nCheckBugFixedAtBlock;
Expand Down
Loading

0 comments on commit 36ce197

Please sign in to comment.