Skip to content

Commit

Permalink
MERGE-FIX: Fix compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenroose committed May 3, 2019
1 parent 7256637 commit 9f4f2e7
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 48 deletions.
2 changes: 1 addition & 1 deletion src/assetsdir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <chainparams.h>

#include <tinyformat.h>
#include <utilstrencodings.h>
#include <util/strencodings.h>

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/blind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <primitives/confidential.h>
#include <issuance.h>
#include <random.h>
#include <util.h>
#include <util/system.h>

static secp256k1_context* secp256k1_blind_context = NULL;

Expand Down
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <ui_interface.h>
#include <util/system.h>
#include <util/moneystr.h>
#include <utilstrencodings.h>
#include <util/strencodings.h>
#include <validation.h>
#include <validationinterface.h>
#include <warnings.h>
Expand Down
4 changes: 2 additions & 2 deletions src/mainchainrpc.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <mainchainrpc.h>

#include <chainparamsbase.h>
#include <util.h>
#include <utilstrencodings.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <rpc/protocol.h>

#include <support/events.h>
Expand Down
2 changes: 1 addition & 1 deletion src/pegins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <script/interpreter.h>
#include <script/standard.h>
#include <streams.h>
#include <util.h>
#include <util/system.h>

//
// ELEMENTS
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/bitcoin/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <hash.h>
#include <tinyformat.h>
#include <utilstrencodings.h>
#include <util/strencodings.h>
#include <crypto/common.h>

namespace Sidechain {
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/bitcoin/merkleblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <hash.h>
#include <consensus/consensus.h>
#include <utilstrencodings.h>
#include <util/strencodings.h>

namespace Sidechain {
namespace Bitcoin {
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/bitcoin/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <hash.h>
#include <tinyformat.h>
#include <utilstrencodings.h>
#include <util/strencodings.h>

namespace Sidechain {
namespace Bitcoin {
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/confidential.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <serialize.h>
#include <span.h>
#include <uint256.h>
#include <utilstrencodings.h>
#include <util/strencodings.h>

extern bool g_con_elementsmode;

Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoinamountfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class AmountSpinBox: public QAbstractSpinBox
if(valid)
{
val = qBound(m_min_amount, val, m_max_amount);
input = GUIUtil::formatAssetAmount(current_asset, val, false, currentUnit, BitcoinUnits::separatorAlways, false);
input = GUIUtil::formatAssetAmount(current_asset, val, currentUnit, BitcoinUnits::separatorAlways, false);
lineEdit()->setText(input);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/qt/forms/sendcoinsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,6 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p
</widget>
</item>
<item>
<widget class="QLabel" name="labelMinFeeWarning">
<widget class="QLabel" name="labelCustomFeeWarning">
<property name="enabled">
<bool>true</bool>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/paymentserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public Q_SLOTS:

#ifdef ENABLE_BIP70
// Submit Payment message to a merchant, get back PaymentACK:
void fetchPaymentACK(WalletModel* walletModel, const SendCoinsRecipient& recipient, QByteArray transaction);
void fetchPaymentACK(WalletModel* walletModel, const SendAssetsRecipient& recipient, QByteArray transaction);
#endif

private Q_SLOTS:
Expand Down
2 changes: 1 addition & 1 deletion src/test/blech32_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <blech32.h>
#include <random.h>
#include <utilstrencodings.h>
#include <util/strencodings.h>
#include <test/test_bitcoin.h>

#include <boost/test/unit_test.hpp>
Expand Down
4 changes: 2 additions & 2 deletions src/test/pegin_spent_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <script/standard.h>
#include <txmempool.h>
#include <uint256.h>
#include <util.h>
#include <utilstrencodings.h>
#include <util/system.h>
#include <util/strencodings.h>

#include <txdb.h>

Expand Down
4 changes: 2 additions & 2 deletions src/test/pegin_witness_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
#include <policy/policy.h>
#include <script/script.h>
#include <script/script_error.h>
#include <utilstrencodings.h>
#include <util/strencodings.h>
#include <validation.h>
#include <streams.h>
#include <test/test_bitcoin.h>
#include <util.h>
#include <util/system.h>

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
Expand Down
24 changes: 15 additions & 9 deletions src/wallet/rpcdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ static UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, con
CScriptID redeem_id(redeemScript);

// Check that the redeemScript and scriptPubKey match
if (GetScriptForDestination(redeem_id) != script) {
if (GetScriptForDestination(ScriptHash(redeem_id)) != script) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "The redeemScript does not match the scriptPubKey");
}

Expand Down Expand Up @@ -1281,7 +1281,8 @@ UniValue getwalletpakinfo(const JSONRPCRequest& request)
"}\n"
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (pwallet->offline_counter == -1) {
throw JSONRPCError(RPC_MISC_ERROR, "This wallet has not been initialized for PAK-enforced peg-outs.");
Expand Down Expand Up @@ -1336,7 +1337,8 @@ UniValue importblindingkey(const JSONRPCRequest& request)
+ HelpExampleCli("importblindingkey", "\"my blinded CT address\" <blindinghex>")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

CTxDestination dest = DecodeDestination(request.params[0].get_str());
if (!IsValidDestination(dest)) {
Expand Down Expand Up @@ -1390,7 +1392,8 @@ UniValue importmasterblindingkey(const JSONRPCRequest& request)
+ HelpExampleCli("importmasterblindingkey", "<hexkey>")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (!IsHex(request.params[0].get_str())) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid hexadecimal for key");
Expand Down Expand Up @@ -1434,7 +1437,8 @@ UniValue importissuanceblindingkey(const JSONRPCRequest& request)
+ HelpExampleCli("importblindingkey", "\"my blinded CT address\" <blindinghex>")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (!request.params[0].isStr() || !IsHex(request.params[0].get_str()) || request.params[0].get_str().size() != 64) {
throw JSONRPCError(RPC_TYPE_ERROR, "First argument must be a txid string");
Expand Down Expand Up @@ -1508,8 +1512,8 @@ UniValue dumpblindingkey(const JSONRPCRequest& request)
+ HelpExampleCli("dumpblindingkey", "\"my address\"")
);

LOCK2(cs_main, pwallet->cs_wallet);

auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

CTxDestination dest = DecodeDestination(request.params[0].get_str());
if (!IsValidDestination(dest)) {
Expand Down Expand Up @@ -1550,7 +1554,8 @@ UniValue dumpmasterblindingkey(const JSONRPCRequest& request)
+ HelpExampleCli("dumpmasterblindingkey", "")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (!pwallet->blinding_derivation_key.IsNull()) {
return HexStr(pwallet->blinding_derivation_key);
Expand Down Expand Up @@ -1581,7 +1586,8 @@ UniValue dumpissuanceblindingkey(const JSONRPCRequest& request)
+ HelpExampleCli("dumpissuanceblindingkey", "\"<txid>\", 0")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (!request.params[0].isStr() || !IsHex(request.params[0].get_str()) || request.params[0].get_str().size() != 64) {
throw JSONRPCError(RPC_TYPE_ERROR, "First argument must be a txid string");
Expand Down
47 changes: 29 additions & 18 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4757,7 +4757,8 @@ UniValue initpegoutwallet(const JSONRPCRequest& request)
+ HelpExampleRpc("initpegoutwallet", "sh(wpkh(tpubDAY5hwtonH4NE8zY46ZMFf6B6F3fqMis7cwfNihXXpAg6XzBZNoHAdAzAZx2peoU8nTWFqvUncXwJ9qgE5VxcnUKxdut8F6mptVmKjfiwDQ/0/*))")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

// Check that network cares about PAK
if (!Params().GetEnforcePak()) {
Expand Down Expand Up @@ -4909,7 +4910,8 @@ UniValue sendtomainchain_base(const JSONRPCRequest& request)
+ HelpExampleRpc("sendtomainchain", "\"mgWEy4vBJSHt3mC8C2SEWJQitifb4qeZQq\" 0.1")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

EnsureWalletIsUnlocked(pwallet);

Expand Down Expand Up @@ -4941,7 +4943,7 @@ UniValue sendtomainchain_base(const JSONRPCRequest& request)

mapValue_t mapValue;
CCoinControl no_coin_control; // This is a deprecated API
CTransactionRef tx = SendMoney(pwallet, address, nAmount, Params().GetConsensus().pegged_asset, subtract_fee, no_coin_control, std::move(mapValue), true /* ignore_blind_fail */);
CTransactionRef tx = SendMoney(*locked_chain, pwallet, address, nAmount, Params().GetConsensus().pegged_asset, subtract_fee, no_coin_control, std::move(mapValue), true /* ignore_blind_fail */);

return (*tx).GetHash().GetHex();

Expand Down Expand Up @@ -5017,7 +5019,8 @@ UniValue sendtomainchain_pak(const JSONRPCRequest& request)
+ HelpExampleRpc("sendtomainchain", "\"\" 0.1")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

EnsureWalletIsUnlocked(pwallet);

Expand Down Expand Up @@ -5183,7 +5186,7 @@ UniValue sendtomainchain_pak(const JSONRPCRequest& request)

mapValue_t mapValue;
CCoinControl no_coin_control; // This is a deprecated API
CTransactionRef tx = SendMoney(pwallet, address, nAmount, Params().GetConsensus().pegged_asset, subtract_fee, no_coin_control, std::move(mapValue), true /* ignore_blind_fail */);
CTransactionRef tx = SendMoney(*locked_chain, pwallet, address, nAmount, Params().GetConsensus().pegged_asset, subtract_fee, no_coin_control, std::move(mapValue), true /* ignore_blind_fail */);

pwallet->SetOfflineCounter(counter+1);

Expand Down Expand Up @@ -5248,7 +5251,8 @@ static UniValue createrawpegin(const JSONRPCRequest& request, T_tx_ref& txBTCRef
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (!IsHex(request.params[0].get_str()) || !IsHex(request.params[1].get_str())) {
throw JSONRPCError(RPC_TYPE_ERROR, "the first two arguments must be hex strings");
Expand Down Expand Up @@ -5467,7 +5471,8 @@ UniValue claimpegin(const JSONRPCRequest& request)
CTransactionRef tx_ref;
CMutableTransaction mtx;

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (IsInitialBlockDownload()) {
throw JSONRPCError(RPC_WALLET_ERROR, "Peg-ins cannot be completed during initial sync or reindexing.");
Expand Down Expand Up @@ -5819,7 +5824,7 @@ static UniValue unblindrawtransaction(const JSONRPCRequest& request)
return result;
}

static CTransactionRef SendGenerationTransaction(const CScript& asset_script, const CPubKey &asset_pubkey, const CScript& token_script, const CPubKey &token_pubkey, CAmount asset_amount, CAmount token_amount, IssuanceDetails* issuance_details, CWallet* pwallet)
static CTransactionRef SendGenerationTransaction(const CScript& asset_script, const CPubKey &asset_pubkey, const CScript& token_script, const CPubKey &token_pubkey, CAmount asset_amount, CAmount token_amount, IssuanceDetails* issuance_details, interfaces::Chain::Lock& locked_chain, CWallet* pwallet)
{
CAsset reissue_token = issuance_details->reissuance_token;
CAmount curBalance = pwallet->GetBalance()[reissue_token];
Expand Down Expand Up @@ -5860,7 +5865,7 @@ static CTransactionRef SendGenerationTransaction(const CScript& asset_script, co
CCoinControl dummy_control;
BlindDetails blind_details;
CTransactionRef tx_ref(MakeTransactionRef());
if (!pwallet->CreateTransaction(vecSend, tx_ref, change_keys, nFeeRequired, nChangePosRet, strError, dummy_control, true, &blind_details, issuance_details)) {
if (!pwallet->CreateTransaction(locked_chain, vecSend, tx_ref, change_keys, nFeeRequired, nChangePosRet, strError, dummy_control, true, &blind_details, issuance_details)) {
throw JSONRPCError(RPC_WALLET_ERROR, strError);
}

Expand Down Expand Up @@ -5905,7 +5910,8 @@ UniValue issueasset(const JSONRPCRequest& request)
+ HelpExampleRpc("issueasset", "10, 0")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

CAmount nAmount = AmountFromValue(request.params[0]);
CAmount nTokens = AmountFromValue(request.params[1]);
Expand Down Expand Up @@ -5946,7 +5952,7 @@ UniValue issueasset(const JSONRPCRequest& request)
CAsset dummyasset;
IssuanceDetails issuance_details;
issuance_details.blind_issuance = blind_issuances;
CTransactionRef tx_ref = SendGenerationTransaction(GetScriptForDestination(asset_dest), asset_dest_blindpub, GetScriptForDestination(token_dest), token_dest_blindpub, nAmount, nTokens, &issuance_details, pwallet);
CTransactionRef tx_ref = SendGenerationTransaction(GetScriptForDestination(asset_dest), asset_dest_blindpub, GetScriptForDestination(token_dest), token_dest_blindpub, nAmount, nTokens, &issuance_details, *locked_chain, pwallet);

// Calculate asset type, assumes first vin is used for issuance
CAsset asset;
Expand Down Expand Up @@ -5992,7 +5998,8 @@ UniValue reissueasset(const JSONRPCRequest& request)
+ HelpExampleRpc("reissueasset", "<asset>, 0")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

std::string assetstr = request.params[0].get_str();
CAsset asset = GetAssetFromString(assetstr);
Expand Down Expand Up @@ -6042,7 +6049,7 @@ UniValue reissueasset(const JSONRPCRequest& request)
CPubKey token_dest_blindpub = pwallet->GetBlindingPubKey(GetScriptForDestination(token_dest));

// Attempt a send.
CTransactionRef tx_ref = SendGenerationTransaction(GetScriptForDestination(asset_dest), asset_dest_blindpub, GetScriptForDestination(token_dest), token_dest_blindpub, nAmount, -1, &issuance_details, pwallet);
CTransactionRef tx_ref = SendGenerationTransaction(GetScriptForDestination(asset_dest), asset_dest_blindpub, GetScriptForDestination(token_dest), token_dest_blindpub, nAmount, -1, &issuance_details, *locked_chain, pwallet);
assert(!tx_ref->vin.empty());

UniValue obj(UniValue::VOBJ);
Expand Down Expand Up @@ -6094,7 +6101,8 @@ UniValue listissuances(const JSONRPCRequest& request)
+ HelpExampleRpc("listissuances", "<asset>")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

std::string assetstr;
CAsset asset_filter;
Expand Down Expand Up @@ -6177,7 +6185,8 @@ UniValue destroyamount(const JSONRPCRequest& request)
+ HelpExampleRpc("destroyamount", "\"bitcoin\" 100 \"destroy assets\"")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

std::string strasset = request.params[0].get_str();
CAsset asset = GetAssetFromString(strasset);
Expand All @@ -6197,7 +6206,7 @@ UniValue destroyamount(const JSONRPCRequest& request)
NullData nulldata;
CTxDestination address(nulldata);
CCoinControl no_coin_control; // This is a deprecated API
CTransactionRef tx = SendMoney(pwallet, address, nAmount, asset, false, no_coin_control, std::move(mapValue), true);
CTransactionRef tx = SendMoney(*locked_chain, pwallet, address, nAmount, asset, false, no_coin_control, std::move(mapValue), true);

return tx->GetHash().GetHex();
}
Expand Down Expand Up @@ -6226,7 +6235,8 @@ UniValue generatepegoutproof(const JSONRPCRequest& request)
+ HelpExampleRpc("generatepegoutproof", "\"cQtNrRngdc4RJ9CkuTVKVLyxPFsijiTJySob24xCdKXGohdFhXML\" \"02c611095119e3dc96db428a0e190a3e142237bcd2efa4fb358257497885af3ab6\" \"0390695fff5535780df1e04c1f6c10e7c0a399fa56cfce34bf8108d0a9bc7a437b\"")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (!IsHex(request.params[1].get_str()))
throw JSONRPCError(RPC_TYPE_ERROR, "btcpubkey must be hex string");
Expand Down Expand Up @@ -6327,7 +6337,8 @@ UniValue getpegoutkeys(const JSONRPCRequest& request)
+ HelpExampleRpc("getpegoutkeys", "\"5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF\", \"0389275d512326f7016e014d8625f709c01f23bd0dc16522bf9845a9ee1ef6cbf9\"")
);

LOCK2(cs_main, pwallet->cs_wallet);
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (!request.params[1].isStr() || !IsHex(request.params[1].get_str()) || request.params[1].get_str().size() != 66) {
throw JSONRPCError(RPC_TYPE_ERROR, "offlinepubkey must be hex string of size 66");
Expand Down
Loading

0 comments on commit 9f4f2e7

Please sign in to comment.