Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/wallet_tests.cpp
// Copyright (c) 2012-2016 The Bitcoin Core developers | // Copyright (c) 2012-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <chain.h> | #include <chain.h> | ||||
#include <chainparams.h> | #include <chainparams.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <consensus/validation.h> | |||||
#include <interfaces/chain.h> | #include <interfaces/chain.h> | ||||
#include <node/context.h> | #include <node/context.h> | ||||
#include <policy/policy.h> | #include <policy/policy.h> | ||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <wallet/coincontrol.h> | #include <wallet/coincontrol.h> | ||||
#include <wallet/rpcdump.h> | #include <wallet/rpcdump.h> | ||||
#include <wallet/wallet.h> | #include <wallet/wallet.h> | ||||
▲ Show 20 Lines • Show All 464 Lines • ▼ Show 20 Lines | CWalletTx &AddTx(CRecipient recipient) { | ||||
int changePos = -1; | int changePos = -1; | ||||
std::string error; | std::string error; | ||||
CCoinControl dummy; | CCoinControl dummy; | ||||
{ | { | ||||
auto locked_chain = m_chain->lock(); | auto locked_chain = m_chain->lock(); | ||||
BOOST_CHECK(wallet->CreateTransaction( | BOOST_CHECK(wallet->CreateTransaction( | ||||
*locked_chain, {recipient}, tx, fee, changePos, error, dummy)); | *locked_chain, {recipient}, tx, fee, changePos, error, dummy)); | ||||
} | } | ||||
TxValidationState state; | wallet->CommitTransaction(tx, {}, {}); | ||||
wallet->CommitTransaction(tx, {}, {}, state); | |||||
CMutableTransaction blocktx; | CMutableTransaction blocktx; | ||||
{ | { | ||||
LOCK(wallet->cs_wallet); | LOCK(wallet->cs_wallet); | ||||
blocktx = | blocktx = | ||||
CMutableTransaction(*wallet->mapWallet.at(tx->GetId()).tx); | CMutableTransaction(*wallet->mapWallet.at(tx->GetId()).tx); | ||||
} | } | ||||
CreateAndProcessBlock({CMutableTransaction(blocktx)}, | CreateAndProcessBlock({CMutableTransaction(blocktx)}, | ||||
GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | GetScriptForRawPubKey(coinbaseKey.GetPubKey())); | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |