Browse Source

Move scriptutils.o to wallet

pull/1/head
jtimon 8 years ago committed by Wladimir J. van der Laan
parent
commit
0d2fa14a34
  1. 2
      src/Makefile.am
  2. 13
      src/test/multisig_tests.cpp
  3. 7
      src/test/script_P2SH_tests.cpp

2
src/Makefile.am

@ -173,6 +173,7 @@ libbitcoin_wallet_a_SOURCES = \ @@ -173,6 +173,7 @@ libbitcoin_wallet_a_SOURCES = \
crypter.cpp \
rpcdump.cpp \
rpcwallet.cpp \
scriptutils.cpp \
wallet.cpp \
walletdb.cpp \
$(BITCOIN_CORE_H)
@ -216,7 +217,6 @@ libbitcoin_common_a_SOURCES = \ @@ -216,7 +217,6 @@ libbitcoin_common_a_SOURCES = \
script/script.cpp \
script/sign.cpp \
script/standard.cpp \
scriptutils.cpp \
$(BITCOIN_CORE_H)
# util: shared between all executables.

13
src/test/multisig_tests.cpp

@ -8,9 +8,12 @@ @@ -8,9 +8,12 @@
#include "script/script.h"
#include "script/interpreter.h"
#include "script/sign.h"
#include "scriptutils.h"
#include "uint256.h"
#ifdef ENABLE_WALLET
#include "scriptutils.h"
#endif
#include <boost/assign/std/vector.hpp>
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
@ -195,8 +198,10 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1) @@ -195,8 +198,10 @@ 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;
@ -208,8 +213,10 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1) @@ -208,8 +213,10 @@ 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;
@ -220,9 +227,11 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1) @@ -220,9 +227,11 @@ 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;
@ -237,9 +246,11 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1) @@ -237,9 +246,11 @@ 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;

7
src/test/script_P2SH_tests.cpp

@ -7,7 +7,10 @@ @@ -7,7 +7,10 @@
#include "main.h"
#include "script/script.h"
#include "script/sign.h"
#ifdef ENABLE_WALLET
#include "scriptutils.h"
#endif
#include <vector>
@ -95,7 +98,9 @@ BOOST_AUTO_TEST_CASE(sign) @@ -95,7 +98,9 @@ BOOST_AUTO_TEST_CASE(sign)
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++)
{
@ -189,7 +194,9 @@ BOOST_AUTO_TEST_CASE(set) @@ -189,7 +194,9 @@ BOOST_AUTO_TEST_CASE(set)
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++)
{

Loading…
Cancel
Save