Skip to content

Commit

Permalink
gcc fixes for dpow (#3)
Browse files Browse the repository at this point in the history
* Revert "Make this beast of burden finally compile"

This reverts commit e491853.

* Make things work with gcc version 5.4.0
  • Loading branch information
leto authored and bedeabza committed Feb 5, 2019
1 parent bfb26b6 commit bd6be7a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/komodo_validation012.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
obj.pushKV("notarized_MoM", NOTARIZED_MOM.GetHex());
}*/

#include "init.h"
#include <wallet/wallet.h>
#include <chainparams.h>
#include <base58.h>
#include "komodo_notaries.h"
#include "validation.h"
#include "init.h"

#define SATOSHIDEN ((uint64_t)100000000L)
#define dstr(x) ((double)(x) / SATOSHIDEN)
Expand Down
1 change: 0 additions & 1 deletion src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <boost/algorithm/string.hpp>

#include <univalue.h>
#include "komodo_validation012.h"

using namespace std;

Expand Down
5 changes: 3 additions & 2 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@
#include <boost/lexical_cast.hpp>
#include <boost/math/distributions/poisson.hpp>
#include <boost/thread.hpp>
#include "komodo_validation012.h"
#include "wallet/wallet.h"

using namespace std;
void komodo_disconnect(CBlockIndex *pindex,CBlock *block);
int32_t komodo_checkpoint(int32_t *notarized_heightp,int32_t nHeight,uint256 hash);
void komodo_connectblock(CBlockIndex *pindex,CBlock& block);

#if defined(NDEBUG)
# error "Gincoin Core cannot be compiled without assertions."
Expand Down
27 changes: 27 additions & 0 deletions src/wallet/rpcdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,33 @@ UniValue importprivkey(const UniValue& params, bool fHelp)
return NullUniValue;
}

void ImportAddress(const CBitcoinAddress& address, const string& strLabel);
void ImportScript(const CScript& script, const string& strLabel, bool isRedeemScript)
{
if (!isRedeemScript && ::IsMine(*pwalletMain, script) == ISMINE_SPENDABLE)
throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script");

pwalletMain->MarkDirty();

if (!pwalletMain->HaveWatchOnly(script) && !pwalletMain->AddWatchOnly(script))
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet");

if (isRedeemScript) {
if (!pwalletMain->HaveCScript(script) && !pwalletMain->AddCScript(script))
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding p2sh redeemScript to wallet");
ImportAddress(CBitcoinAddress(CScriptID(script)), strLabel);
}
}

void ImportAddress(const CBitcoinAddress& address, const string& strLabel)
{
CScript script = GetScriptForDestination(address.Get());
ImportScript(script, strLabel, false);
// add to address book or update label
if (address.IsValid())
pwalletMain->SetAddressBook(address.Get(), strLabel, "receive");
}

UniValue importaddress(const UniValue& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
Expand Down
29 changes: 0 additions & 29 deletions src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1096,33 +1096,4 @@ class CAccount
}
};

using namespace std;

void ImportAddress(const CBitcoinAddress& address, const string& strLabel);
void ImportScript(const CScript& script, const string& strLabel, bool isRedeemScript)
{
if (!isRedeemScript && ::IsMine(*pwalletMain, script) == ISMINE_SPENDABLE)
throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script");

pwalletMain->MarkDirty();

if (!pwalletMain->HaveWatchOnly(script) && !pwalletMain->AddWatchOnly(script))
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet");

if (isRedeemScript) {
if (!pwalletMain->HaveCScript(script) && !pwalletMain->AddCScript(script))
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding p2sh redeemScript to wallet");
ImportAddress(CBitcoinAddress(CScriptID(script)), strLabel);
}
}

void ImportAddress(const CBitcoinAddress& address, const string& strLabel)
{
CScript script = GetScriptForDestination(address.Get());
ImportScript(script, strLabel, false);
// add to address book or update label
if (address.IsValid())
pwalletMain->SetAddressBook(address.Get(), strLabel, "receive");
}

#endif // BITCOIN_WALLET_WALLET_H

0 comments on commit bd6be7a

Please sign in to comment.