Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor adjustments for the tests and codestyle #1066

Merged
merged 1 commit into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/esperanza/walletextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ bool WalletExtension::SetMasterKeyFromSeed(const key::mnemonic::Seed &seed,
}

bool WalletExtension::BackupWallet() {
const std::string wallet_file_name = m_enclosing_wallet.GetName().empty() ?
"wallet.dat" : m_enclosing_wallet.GetName();
const std::string wallet_file_name = m_enclosing_wallet.GetName().empty() ? "wallet.dat" : m_enclosing_wallet.GetName();
castarco marked this conversation as resolved.
Show resolved Hide resolved
const int64_t current_time = GetTime();

const std::string backup_wallet_filename =
Expand Down Expand Up @@ -612,7 +611,6 @@ void WalletExtension::VoteIfNeeded() {
return;
}


const CWalletTx *prev_tx = m_enclosing_wallet.GetWalletTx(validator->m_last_transaction_hash);
assert(prev_tx);

Expand Down
10 changes: 5 additions & 5 deletions src/test/mempool_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
tx2.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx2.vout[0].nValue = 2 * UNIT;
pool.addUnchecked(tx2.GetHash(), entry.Fee(20000LL).FromTx(tx2));
uint64_t tx2Size = GetVirtualTransactionSize(tx2);
uint64_t tx2Size = GetVirtualTransactionSize(tx2, entry.sigOpCost);

/* lowest fee */
CMutableTransaction tx3 = CMutableTransaction();
Expand Down Expand Up @@ -357,7 +357,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
tx6.vout.resize(1);
tx6.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx6.vout[0].nValue = 20 * UNIT;
uint64_t tx6Size = GetVirtualTransactionSize(tx6);
uint64_t tx6Size = GetVirtualTransactionSize(tx6, entry.sigOpCost);

pool.addUnchecked(tx6.GetHash(), entry.Fee(0LL).FromTx(tx6));
BOOST_CHECK_EQUAL(pool.size(), 6U);
Expand All @@ -376,7 +376,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
tx7.vout.resize(1);
tx7.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx7.vout[0].nValue = 10 * UNIT;
uint64_t tx7Size = GetVirtualTransactionSize(tx7);
uint64_t tx7Size = GetVirtualTransactionSize(tx7, entry.sigOpCost);

/* set the fee to just below tx2's feerate when including ancestor */
CAmount fee = (20000/tx2Size)*(tx7Size + tx6Size) - 1;
Expand Down Expand Up @@ -464,12 +464,12 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
BOOST_CHECK(pool.exists(tx2.GetHash()));
BOOST_CHECK(pool.exists(tx3.GetHash()));

pool.TrimToSize(GetVirtualTransactionSize(tx1)); // mempool is limited to tx1's size in memory usage, so nothing fits
pool.TrimToSize(GetVirtualTransactionSize(tx1, entry.sigOpCost)); // mempool is limited to tx1's size in memory usage, so nothing fits
BOOST_CHECK(!pool.exists(tx1.GetHash()));
BOOST_CHECK(!pool.exists(tx2.GetHash()));
BOOST_CHECK(!pool.exists(tx3.GetHash()));

CFeeRate maxFeeRateRemoved(25000, GetVirtualTransactionSize(tx3) + GetVirtualTransactionSize(tx2));
CFeeRate maxFeeRateRemoved(25000, GetVirtualTransactionSize(tx3, entry.sigOpCost) + GetVirtualTransactionSize(tx2, entry.sigOpCost));
BOOST_CHECK_EQUAL(pool.GetMinFee(1).GetFeePerK(), maxFeeRateRemoved.GetFeePerK() + 1000);

CMutableTransaction tx4 = CMutableTransaction();
Expand Down
2 changes: 1 addition & 1 deletion src/usbdevice/rpcusbdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <key_io.h>
#include <extkey.h>
#include <key.h>
#include <key_io.h>
#include <rpc/protocol.h>
#include <rpc/server.h>
#include <usbdevice/usbdevice.h>
Expand Down
1 change: 0 additions & 1 deletion test/functional/p2p_fingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def run_test(self):
snapshot_meta = get_tip_snapshot_meta(self.nodes[0])
unspent_outputs = get_unspent_coins(self.nodes[0], 5, lock=True)
block_hashes += self.nodes[0].generate(nblocks=2)
unspent_outputs = get_unspent_coins(self.nodes[0], 5)

# Create longer chain starting 2 blocks before current tip
height = len(block_hashes) - 2
Expand Down