wallet_ismine.h → script/ismine.h

Removes conditional dependency of `src/test` on wallet.

Makes multisig and P2SH tests complete without wallet built-in.
This commit is contained in:
Wladimir J. van der Laan 2016-04-18 15:12:46 +02:00 committed by Jack Grigg
parent 91f0b506ca
commit 3782c4d6ab
No known key found for this signature in database
GPG Key ID: 9E8255172BBF9898
6 changed files with 9 additions and 26 deletions

View File

@ -177,6 +177,7 @@ BITCOIN_CORE_H = \
script/sigcache.h \
script/sign.h \
script/standard.h \
script/ismine.h \
serialize.h \
spentindex.h \
streams.h \
@ -217,7 +218,6 @@ BITCOIN_CORE_H = \
wallet/paymentdisclosuredb.h \
wallet/rpcwallet.h \
wallet/wallet.h \
wallet/wallet_ismine.h \
wallet/walletdb.h \
zmq/zmqabstractnotifier.h \
zmq/zmqconfig.h\
@ -266,6 +266,7 @@ libbitcoin_server_a_SOURCES = \
rpc/rawtransaction.cpp \
rpc/server.cpp \
script/sigcache.cpp \
script/ismine.cpp \
timedata.cpp \
torcontrol.cpp \
txdb.cpp \
@ -312,7 +313,6 @@ libbitcoin_wallet_a_SOURCES = \
wallet/rpcdump.cpp \
wallet/rpcwallet.cpp \
wallet/wallet.cpp \
wallet/wallet_ismine.cpp \
wallet/walletdb.cpp \
$(BITCOIN_CORE_H) \
$(LIBZCASH_H)

View File

@ -3,7 +3,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
#include "wallet_ismine.h"
#include "ismine.h"
#include "key.h"
#include "keystore.h"

View File

@ -3,8 +3,8 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
#ifndef BITCOIN_WALLET_WALLET_ISMINE_H
#define BITCOIN_WALLET_WALLET_ISMINE_H
#ifndef BITCOIN_SCRIPT_ISMINE_H
#define BITCOIN_SCRIPT_ISMINE_H
#include "key.h"
#include "script/standard.h"
@ -30,4 +30,4 @@ typedef uint8_t isminefilter;
isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey);
isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest);
#endif // BITCOIN_WALLET_WALLET_ISMINE_H
#endif // BITCOIN_SCRIPT_ISMINE_H

View File

@ -10,12 +10,10 @@
#include "script/script_error.h"
#include "script/interpreter.h"
#include "script/sign.h"
#include "script/ismine.h"
#include "uint256.h"
#include "test/test_bitcoin.h"
#ifdef ENABLE_WALLET
#include "wallet/wallet_ismine.h"
#endif
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
@ -215,10 +213,8 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
CTxDestination addr;
BOOST_CHECK(ExtractDestination(s, addr));
BOOST_CHECK(addr == keyaddr[0]);
#ifdef ENABLE_WALLET
BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s));
#endif
}
{
vector<valtype> solutions;
@ -230,10 +226,8 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
CTxDestination addr;
BOOST_CHECK(ExtractDestination(s, addr));
BOOST_CHECK(addr == keyaddr[0]);
#ifdef ENABLE_WALLET
BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s));
#endif
}
{
vector<valtype> solutions;
@ -244,11 +238,9 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
BOOST_CHECK_EQUAL(solutions.size(), 4U);
CTxDestination addr;
BOOST_CHECK(!ExtractDestination(s, addr));
#ifdef ENABLE_WALLET
BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s));
BOOST_CHECK(!IsMine(partialkeystore, s));
#endif
}
{
vector<valtype> solutions;
@ -263,11 +255,9 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
BOOST_CHECK(addrs[0] == keyaddr[0]);
BOOST_CHECK(addrs[1] == keyaddr[1]);
BOOST_CHECK(nRequired == 1);
#ifdef ENABLE_WALLET
BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s));
BOOST_CHECK(!IsMine(partialkeystore, s));
#endif
}
{
vector<valtype> solutions;

View File

@ -11,12 +11,9 @@
#include "script/script.h"
#include "script/script_error.h"
#include "script/sign.h"
#include "script/ismine.h"
#include "test/test_bitcoin.h"
#ifdef ENABLE_WALLET
#include "wallet/wallet_ismine.h"
#endif
#include <vector>
#include <boost/test/unit_test.hpp>
@ -106,9 +103,7 @@ BOOST_DATA_TEST_CASE(sign, boost::unit_test::data::xrange(static_cast<int>(Conse
txTo[i].vin[0].prevout.n = i;
txTo[i].vin[0].prevout.hash = txFrom.GetHash();
txTo[i].vout[0].nValue = 1;
#ifdef ENABLE_WALLET
BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i));
#endif
}
for (int i = 0; i < 8; i++)
{
@ -210,9 +205,7 @@ BOOST_DATA_TEST_CASE(set, boost::unit_test::data::xrange(static_cast<int>(Consen
txTo[i].vin[0].prevout.hash = txFrom.GetHash();
txTo[i].vout[0].nValue = 1*CENT;
txTo[i].vout[0].scriptPubKey = inner[i];
#ifdef ENABLE_WALLET
BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i));
#endif
}
for (int i = 0; i < 4; i++)
{

View File

@ -19,8 +19,8 @@
#include "util.h"
#include "utilstrencodings.h"
#include "validationinterface.h"
#include "script/ismine.h"
#include "wallet/crypter.h"
#include "wallet/wallet_ismine.h"
#include "wallet/walletdb.h"
#include "wallet/rpcwallet.h"
#include "zcash/Address.hpp"