MERGE-FIX: various compilation fixes

This commit is contained in:
Gregory Sanders 2019-01-28 06:47:00 -05:00
parent c62fab2d69
commit 51584e73a3
11 changed files with 29 additions and 28 deletions

View file

@ -56,7 +56,7 @@ if ENABLE_WALLET
bench_bench_bitcoin_SOURCES += bench/coin_selection.cpp bench_bench_bitcoin_SOURCES += bench/coin_selection.cpp
endif endif
bench_bench_bitcoin_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) bench_bench_bitcoin_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_LIBS)
bench_bench_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) bench_bench_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
CLEAN_BITCOIN_BENCH = bench/*.gcda bench/*.gcno $(GENERATED_BENCH_FILES) CLEAN_BITCOIN_BENCH = bench/*.gcda bench/*.gcno $(GENERATED_BENCH_FILES)

View file

@ -125,7 +125,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
// Pad block weight to account for OP_RETURN commitments with two compressed pubkeys // Pad block weight to account for OP_RETURN commitments with two compressed pubkeys
for (const auto& commitment : commitments) { for (const auto& commitment : commitments) {
CTxOut output(0, commitment); CTxOut output(0, commitment);
nBlockWeight += ::GetSerializeSize(output, SER_NETWORK, PROTOCOL_VERSION)*WITNESS_SCALE_FACTOR; nBlockWeight += ::GetSerializeSize(output, PROTOCOL_VERSION)*WITNESS_SCALE_FACTOR;
} }
// END PAK // END PAK

View file

@ -96,7 +96,7 @@ CAmount CTransaction::GetValueOut() const
unsigned int CTransaction::GetTotalSize() const unsigned int CTransaction::GetTotalSize() const
{ {
return ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION); return ::GetSerializeSize(*this, PROTOCOL_VERSION);
} }
std::string CTransaction::ToString() const std::string CTransaction::ToString() const

View file

@ -492,9 +492,9 @@ UniValue FormatPAKList(CPAKList &paklist) {
retOnline.push_back(HexStr(online_keys[i])); retOnline.push_back(HexStr(online_keys[i]));
} }
paklist_value.push_back(Pair("online", retOnline)); paklist_value.pushKV("online", retOnline);
paklist_value.push_back(Pair("offline", retOffline)); paklist_value.pushKV("offline", retOffline);
paklist_value.push_back(Pair("reject", is_reject)); paklist_value.pushKV("reject", is_reject);
return paklist_value; return paklist_value;
} }

View file

@ -1019,7 +1019,6 @@ UniValue signrawtransaction(const JSONRPCRequest& request)
// CRPCCommand table and rpc/client.cpp. // CRPCCommand table and rpc/client.cpp.
throw JSONRPCError(RPC_METHOD_DEPRECATED, "signrawtransaction was removed in v0.18.\n" throw JSONRPCError(RPC_METHOD_DEPRECATED, "signrawtransaction was removed in v0.18.\n"
"Clients should transition to using signrawtransactionwithkey and signrawtransactionwithwallet"); "Clients should transition to using signrawtransactionwithkey and signrawtransactionwithwallet");
" \"warning\" : \"text\" (string) Warning that a peg-in input signed may be immature. This could mean lack of connectivity to or misconfiguration of the bitcoind."
} }
UniValue sendrawtransaction(const JSONRPCRequest& request) UniValue sendrawtransaction(const JSONRPCRequest& request)

View file

@ -95,8 +95,7 @@ txnouttype Solver(const CScript& scriptPubKey, std::vector<std::vector<unsigned
vSolutionsRet.clear(); vSolutionsRet.clear();
if (Params().anyonecanspend_aremine && scriptPubKey == CScript() << OP_TRUE) { if (Params().anyonecanspend_aremine && scriptPubKey == CScript() << OP_TRUE) {
typeRet = TX_TRUE; return TX_TRUE;
return true;
} }
// Shortcut for pay-to-script-hash, which are more constrained than the other types: // Shortcut for pay-to-script-hash, which are more constrained than the other types:

View file

@ -928,6 +928,9 @@ public:
} }
int GetVersion() const { return nVersion; } int GetVersion() const { return nVersion; }
// ELEMENTS: Required for CProof size computation to deal with SER_GETHASH
int GetType() const { return 0; }
}; };
template<typename Stream> template<typename Stream>

View file

@ -446,7 +446,7 @@ BOOST_AUTO_TEST_CASE(PeginSpentTest)
tx.vout.resize(1); tx.vout.resize(1);
tx.vout[0].nValue = 0; tx.vout[0].nValue = 0;
const uint256 tx1Hash(tx.GetHash()); const uint256 tx1Hash(tx.GetHash());
pool.addUnchecked(tx1Hash, entry.PeginsSpent(setPeginsSpent).FromTx(tx)); pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
BOOST_CHECK(pool.mapPeginsSpentToTxid.empty()); BOOST_CHECK(pool.mapPeginsSpentToTxid.empty());
setPeginsSpent = {pegin1}; setPeginsSpent = {pegin1};
@ -454,7 +454,7 @@ BOOST_AUTO_TEST_CASE(PeginSpentTest)
tx.vout.resize(2); tx.vout.resize(2);
tx.vout[1].nValue = 0; tx.vout[1].nValue = 0;
const uint256 tx2Hash(tx.GetHash()); const uint256 tx2Hash(tx.GetHash());
pool.addUnchecked(tx2Hash, entry.PeginsSpent(setPeginsSpent).FromTx(tx)); pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin1].ToString(), tx2Hash.ToString()); BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin1].ToString(), tx2Hash.ToString());
setPeginsSpent = {pegin2}; setPeginsSpent = {pegin2};
@ -462,7 +462,7 @@ BOOST_AUTO_TEST_CASE(PeginSpentTest)
tx.vout.resize(3); tx.vout.resize(3);
tx.vout[2].nValue = 0; tx.vout[2].nValue = 0;
const uint256 tx3Hash(tx.GetHash()); const uint256 tx3Hash(tx.GetHash());
pool.addUnchecked(tx3Hash, entry.PeginsSpent(setPeginsSpent).FromTx(tx)); pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin2].ToString(), tx3Hash.ToString()); BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin2].ToString(), tx3Hash.ToString());
setPeginsSpent = {pegin3}; setPeginsSpent = {pegin3};
@ -493,7 +493,7 @@ BOOST_AUTO_TEST_CASE(PeginSpentTest)
tx.vout.resize(6); tx.vout.resize(6);
tx.vout[5].nValue = 0; tx.vout[5].nValue = 0;
const uint256 tx4Hash(tx.GetHash()); const uint256 tx4Hash(tx.GetHash());
pool.addUnchecked(tx4Hash, entry.PeginsSpent(setPeginsSpent).FromTx(tx)); pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin1].ToString(), tx4Hash.ToString()); BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin1].ToString(), tx4Hash.ToString());
BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin3].ToString(), tx4Hash.ToString()); BOOST_CHECK_EQUAL(pool.mapPeginsSpentToTxid[pegin3].ToString(), tx4Hash.ToString());

View file

@ -21,7 +21,7 @@
CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& _tx, const CAmount& _nFee, CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& _tx, const CAmount& _nFee,
int64_t _nTime, unsigned int _entryHeight, int64_t _nTime, unsigned int _entryHeight,
bool _spendsCoinbase, int64_t _sigOpsCost, LockPoints lp, std::set<std::pair<uint256, COutPoint>>& _setPeginsSpent): bool _spendsCoinbase, int64_t _sigOpsCost, LockPoints lp, std::set<std::pair<uint256, COutPoint>>& _setPeginsSpent)
: tx(_tx), nFee(_nFee), nTxWeight(GetTransactionWeight(*tx)), nUsageSize(RecursiveDynamicUsage(tx)), nTime(_nTime), entryHeight(_entryHeight), : tx(_tx), nFee(_nFee), nTxWeight(GetTransactionWeight(*tx)), nUsageSize(RecursiveDynamicUsage(tx)), nTime(_nTime), entryHeight(_entryHeight),
spendsCoinbase(_spendsCoinbase), sigOpCost(_sigOpsCost), lockPoints(lp), spendsCoinbase(_spendsCoinbase), sigOpCost(_sigOpsCost), lockPoints(lp),
setPeginsSpent(_setPeginsSpent) setPeginsSpent(_setPeginsSpent)
@ -406,7 +406,7 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces
typedef std::pair<uint256, COutPoint> PeginPair; typedef std::pair<uint256, COutPoint> PeginPair;
for(const PeginPair& it : entry.setPeginsSpent) { for(const PeginPair& it : entry.setPeginsSpent) {
std::pair<std::map<std::pair<uint256, COutPoint>, uint256>::iterator, bool> ret = mapPeginsSpentToTxid.insert(std::make_pair(it, hash)); std::pair<std::map<std::pair<uint256, COutPoint>, uint256>::iterator, bool> ret = mapPeginsSpentToTxid.insert(std::make_pair(it, tx.GetHash()));
assert(ret.second); assert(ret.second);
} }
} }

View file

@ -1284,7 +1284,7 @@ UniValue getwalletpakinfo(const JSONRPCRequest& request)
UniValue ret(UniValue::VOBJ); UniValue ret(UniValue::VOBJ);
std::stringstream ss; std::stringstream ss;
ss << pwallet->offline_counter; ss << pwallet->offline_counter;
ret.push_back(Pair("bip32_counter", ss.str())); ret.pushKV("bip32_counter", ss.str());
const std::string desc_str = pwallet->offline_desc; const std::string desc_str = pwallet->offline_desc;
@ -1306,6 +1306,6 @@ UniValue getwalletpakinfo(const JSONRPCRequest& request)
address_list.push_back(EncodeParentDestination(destination)); address_list.push_back(EncodeParentDestination(destination));
} }
ret.push_back(Pair("address_lookahead", address_list)); ret.pushKV("address_lookahead", address_list);
return ret; return ret;
} }

View file

@ -4387,10 +4387,10 @@ UniValue initpegoutwallet(const JSONRPCRequest& request)
address_list.push_back(EncodeParentDestination(destination)); address_list.push_back(EncodeParentDestination(destination));
} }
UniValue pak(UniValue::VOBJ); UniValue pak(UniValue::VOBJ);
pak.push_back(Pair("pakentry", "pak=" + HexStr(negatedpubkeybytes) + ":" + HexStr(online_pubkey))); pak.pushKV("pakentry", "pak=" + HexStr(negatedpubkeybytes) + ":" + HexStr(online_pubkey));
pak.push_back(Pair("liquid_pak", HexStr(online_pubkey))); pak.pushKV("liquid_pak", HexStr(online_pubkey));
pak.push_back(Pair("liquid_pak_address", EncodeDestination(online_key_id))); pak.pushKV("liquid_pak_address", EncodeDestination(online_key_id));
pak.push_back(Pair("address_lookahead", address_list)); pak.pushKV("address_lookahead", address_list);
return pak; return pak;
} }
@ -4450,7 +4450,7 @@ UniValue sendtomainchain_base(const JSONRPCRequest& request)
mapValue_t mapValue; mapValue_t mapValue;
CCoinControl no_coin_control; // This is a deprecated API CCoinControl no_coin_control; // This is a deprecated API
CTransactionRef tx = SendMoney(pwallet, address, nAmount, subtract_fee, no_coin_control, std::move(mapValue), {}); CTransactionRef tx = SendMoney(pwallet, address, nAmount, subtract_fee, no_coin_control, std::move(mapValue));
//TODO(rebase) CT/CA //TODO(rebase) CT/CA
// v this line was in elements-0.14 instead of the line above here // v this line was in elements-0.14 instead of the line above here
@ -4695,7 +4695,7 @@ UniValue sendtomainchain_pak(const JSONRPCRequest& request)
mapValue_t mapValue; mapValue_t mapValue;
CCoinControl no_coin_control; // This is a deprecated API CCoinControl no_coin_control; // This is a deprecated API
CTransactionRef tx = SendMoney(pwallet, address, nAmount, subtract_fee, no_coin_control, std::move(mapValue), {}); CTransactionRef tx = SendMoney(pwallet, address, nAmount, subtract_fee, no_coin_control, std::move(mapValue));
pwallet->SetOfflineCounter(counter+1); pwallet->SetOfflineCounter(counter+1);
@ -4703,10 +4703,10 @@ UniValue sendtomainchain_pak(const JSONRPCRequest& request)
ss << counter; ss << counter;
UniValue obj(UniValue::VOBJ); UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("txid", tx->GetHash().GetHex())); obj.pushKV("txid", tx->GetHash().GetHex());
obj.push_back(Pair("bitcoin_address", EncodeParentDestination(bitcoin_address))); obj.pushKV("bitcoin_address", EncodeParentDestination(bitcoin_address));
obj.push_back(Pair("bip32_counter", ss.str())); obj.pushKV("bip32_counter", ss.str());
obj.push_back(Pair("bitcoin_descriptor", pwallet->offline_desc)); obj.pushKV("bitcoin_descriptor", pwallet->offline_desc);
return obj; return obj;
} }
@ -5009,7 +5009,7 @@ UniValue claimpegin(const JSONRPCRequest& request)
CValidationState state; CValidationState state;
mapValue_t mapValue; mapValue_t mapValue;
CReserveKey reservekey(pwallet); CReserveKey reservekey(pwallet);
if (!pwallet->CommitTransaction(MakeTransactionRef(mtx), mapValue, {} /* orderForm */, "", reservekey, g_connman.get(), state)) { if (!pwallet->CommitTransaction(MakeTransactionRef(mtx), mapValue, {} /* orderForm */, reservekey, g_connman.get(), state)) {
std::string strError = strprintf("Error: The transaction was rejected! Reason given: %s", FormatStateMessage(state)); std::string strError = strprintf("Error: The transaction was rejected! Reason given: %s", FormatStateMessage(state));
throw JSONRPCError(RPC_WALLET_ERROR, strError); throw JSONRPCError(RPC_WALLET_ERROR, strError);
} }