Skip to content

Commit 633bd05

Browse files
2 parents 8a6cf45 + c0465b4 commit 633bd05

31 files changed

+311
-137
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,14 @@ after_success:
226226
- set -o errexit; source ./ci/extended_lint/06_script.sh
227227

228228
- stage: test
229-
name: 'ARM [GOAL: install] [unit tests, functional tests]'
229+
name: 'ARM [GOAL: install] [bionic] [unit tests, functional tests]'
230230
arch: arm64
231231
env: >-
232232
FILE_ENV="./ci/test/00_setup_env_arm.sh"
233233
QEMU_USER_CMD="" # Can run the tests natively without qemu
234234
235235
- stage: test
236-
name: 'S390x [GOAL: install] [unit tests, functional tests]'
236+
name: 'S390x [GOAL: install] [bionic] [unit tests, functional tests]'
237237
arch: s390x
238238
env: >-
239239
FILE_ENV="./ci/test/00_setup_env_s390x.sh"

ci/dash/matrix.sh

+2
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@ elif [ "$BUILD_TARGET" = "linux64_nowallet" ]; then
3636
source ./ci/test/00_setup_env_native_nowallet.sh
3737
elif [ "$BUILD_TARGET" = "mac" ]; then
3838
source ./ci/test/00_setup_env_mac.sh
39+
elif [ "$BUILD_TARGET" = "s390x" ]; then
40+
source ./ci/test/00_setup_env_s390x.sh
3941
fi

ci/test/00_setup_env_s390x.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
77
export LC_ALL=C.UTF-8
88

99
export HOST=s390x-unknown-linux-gnu
10-
export DOCKER_NAME_TAG=s390x/ubuntu:18.04
1110
export PACKAGES="clang llvm python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev"
1211
export NO_DEPENDS=1
1312
export RUN_UNIT_TESTS=true
14-
export RUN_FUNCTIONAL_TESTS=false
13+
export RUN_FUNCTIONAL_TESTS=true
1514
export GOAL="install"
1615
export BITCOIN_CONFIG="--enable-reduce-exports --with-incompatible-bdb"
17-
18-
lscpu

ci/test/04_install.sh

+2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ if [ "$TRAVIS_OS_NAME" == "osx" ]; then
8080
else
8181
DOCKER_EXEC free -m -h
8282
DOCKER_EXEC echo "Number of CPUs \(nproc\):" \$\(nproc\)
83+
DOCKER_EXEC echo "Free disk space:"
84+
DOCKER_EXEC df -h
8385
fi
8486

8587
if [ -n "$DPKG_ADD_ARCH" ]; then

doc/release-notes-17437.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Low-level RPC Changes
2+
===
3+
4+
- The RPC gettransaction, listtransactions and listsinceblock responses now also
5+
includes the height of the block that contains the wallet transaction, if any.

src/bloom.h

-3
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ class CBloomFilter
117117
class CRollingBloomFilter
118118
{
119119
public:
120-
// A random bloom filter calls GetRand() at creation time.
121-
// Don't create global CRollingBloomFilter objects, as they may be
122-
// constructed before the randomizer is properly initialized.
123120
CRollingBloomFilter(const unsigned int nElements, const double nFPRate);
124121

125122
void insert(const std::vector<unsigned char>& vKey);

src/net.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3771,7 +3771,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
37713771
addrBind(addrBindIn),
37723772
fInbound(fInboundIn),
37733773
nKeyedNetGroup(nKeyedNetGroupIn),
3774-
addrKnown(5000, 0.001),
3774+
m_addr_known{block_relay_only ? nullptr : std::make_unique<CRollingBloomFilter>(5000, 0.001)},
37753775
m_block_relay_only_peer(block_relay_only),
37763776
id(idIn),
37773777
nLocalHostNonce(nLocalHostNonceIn),

src/net.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ class CNode
10461046

10471047
// flood relay
10481048
std::vector<CAddress> vAddrToSend;
1049-
CRollingBloomFilter addrKnown;
1049+
const std::unique_ptr<CRollingBloomFilter> m_addr_known;
10501050
bool fGetAddr{false};
10511051
int64_t nNextAddrSend GUARDED_BY(cs_sendProcessing){0};
10521052
int64_t nNextLocalAddrSend GUARDED_BY(cs_sendProcessing){0};
@@ -1056,7 +1056,7 @@ class CNode
10561056
// Don't relay addr messages to peers that we connect to as block-relay-only
10571057
// peers (to prevent adversaries from inferring these links from addr
10581058
// traffic).
1059-
bool IsAddrRelayPeer() const { return !m_block_relay_only_peer; }
1059+
bool IsAddrRelayPeer() const { return m_addr_known != nullptr; }
10601060

10611061
bool IsBlockRelayOnly() const
10621062
{
@@ -1238,7 +1238,8 @@ class CNode
12381238

12391239
void AddAddressKnown(const CAddress& _addr)
12401240
{
1241-
addrKnown.insert(_addr.GetKey());
1241+
assert(m_addr_known);
1242+
m_addr_known->insert(_addr.GetKey());
12421243
}
12431244

12441245
/**
@@ -1256,7 +1257,8 @@ class CNode
12561257
// Known checking here is only to save space from duplicates.
12571258
// SendMessages will filter it again for knowns that were added
12581259
// after addresses were pushed.
1259-
if (_addr.IsValid() && !addrKnown.contains(_addr.GetKey()) && IsAddrCompatible(_addr)) {
1260+
assert(m_addr_known);
1261+
if (_addr.IsValid() && !m_addr_known->contains(_addr.GetKey()) && IsAddrCompatible(_addr)) {
12601262
if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) {
12611263
vAddrToSend[insecure_rand.randrange(vAddrToSend.size())] = _addr;
12621264
} else {

src/net_processing.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ static void RelayAddress(const CAddress& addr, bool fReachable, CConnman& connma
16771677
{
16781678
// Relay to a limited number of other nodes
16791679
// Use deterministic randomness to send to the same nodes for 24 hours
1680-
// at a time so the addrKnowns of the chosen nodes prevent repeats
1680+
// at a time so the m_addr_knowns of the chosen nodes prevent repeats
16811681
uint64_t hashAddr = addr.GetHash();
16821682
const CSipHasher hasher = connman.GetDeterministicRandomizer(RANDOMIZER_ID_ADDRESS_RELAY).Write(hashAddr << 32).Write((GetTime() + hashAddr) / (24*60*60));
16831683
FastRandomContext insecure_rand;
@@ -4530,11 +4530,12 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
45304530
make_flags = 0;
45314531
}
45324532

4533+
assert(pto->m_addr_known);
45334534
for (const CAddress& addr : pto->vAddrToSend)
45344535
{
4535-
if (!pto->addrKnown.contains(addr.GetKey()))
4536+
if (!pto->m_addr_known->contains(addr.GetKey()))
45364537
{
4537-
pto->addrKnown.insert(addr.GetKey());
4538+
pto->m_addr_known->insert(addr.GetKey());
45384539
vAddr.push_back(addr);
45394540
// receiver rejects addr messages larger than 1000
45404541
if (vAddr.size() >= 1000)

src/qt/forms/sendcoinsdialog.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@
11161116
<number>3</number>
11171117
</property>
11181118
<item>
1119-
<widget class="QLabel" name="labelBalanceText">
1119+
<widget class="QLabel" name="labelBalanceName">
11201120
<property name="text">
11211121
<string>Balance:</string>
11221122
</property>

src/qt/res/css/general.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,7 @@ QDialog#SendCoinsDialog .QScrollArea#scrollArea .QWidget#scrollAreaWidgetContent
16941694
background-color: #00000000;
16951695
}
16961696

1697-
QDialog#SendCoinsDialog QLabel#labelBalanceText,
1697+
QDialog#SendCoinsDialog QLabel#labelBalanceName,
16981698
QDialog#SendCoinsDialog QLabel#labelBalance {
16991699
qproperty-alignment: 'AlignLeading | AlignLeft';
17001700
min-height: 20px;

src/qt/sendcoinsdialog.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ SendCoinsDialog::SendCoinsDialog(bool _fCoinJoin, QWidget* parent) :
7979
}, GUIUtil::FontWeight::Bold);
8080

8181
GUIUtil::setFont({ui->labelBalance,
82-
ui->labelBalanceText
82+
ui->labelBalanceName,
8383
}, GUIUtil::FontWeight::Bold, 14);
8484

8585
GUIUtil::setFont({ui->labelCoinControlFeatures
@@ -641,14 +641,17 @@ void SendCoinsDialog::setBalance(const interfaces::WalletBalances& balances)
641641
{
642642
if(model && model->getOptionsModel())
643643
{
644-
CAmount bal = 0;
645-
if (m_coin_control->IsUsingCoinJoin()) {
646-
bal = balances.anonymized_balance;
644+
CAmount balance = 0;
645+
if (model->privateKeysDisabled()) {
646+
balance = balances.watch_only_balance;
647+
ui->labelBalanceName->setText(tr("Watch-only balance:"));
648+
} else if (m_coin_control->IsUsingCoinJoin()) {
649+
balance = balances.anonymized_balance;
647650
} else {
648-
bal = balances.balance;
651+
balance = balances.balance;
649652
}
650653

651-
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), bal));
654+
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), balance));
652655
}
653656
}
654657

src/qt/test/wallettests.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ void TestGUI(interfaces::Node& node)
139139
sendCoinsDialog.setModel(&walletModel);
140140
transactionView.setModel(&walletModel);
141141

142+
{
143+
// Check balance in send dialog
144+
QLabel* balanceLabel = sendCoinsDialog.findChild<QLabel*>("labelBalance");
145+
QString balanceText = balanceLabel->text();
146+
int unit = walletModel.getOptionsModel()->getDisplayUnit();
147+
CAmount balance = walletModel.wallet().getBalance();
148+
QString balanceComparison = BitcoinUnits::formatWithUnit(unit, balance, false /*, BitcoinUnits::separatorAlways*/);
149+
QCOMPARE(balanceText, balanceComparison);
150+
}
151+
142152
// Send two transactions, and verify they are added to transaction list.
143153
TransactionTableModel* transactionTableModel = walletModel.getTransactionTableModel();
144154
QCOMPARE(transactionTableModel->rowCount({}), 105);

src/script/descriptor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,8 @@ std::unique_ptr<DescriptorImpl> ParseScript(uint32_t key_exp_index, Span<const c
841841
}
842842
}
843843
if (ctx == ParseScriptContext::P2SH) {
844-
if (script_size + 3 > 520) {
845-
error = strprintf("P2SH script is too large, %d bytes is larger than 520 bytes", script_size + 3);
844+
if (script_size + 3 > MAX_SCRIPT_ELEMENT_SIZE) {
845+
error = strprintf("P2SH script is too large, %d bytes is larger than %d bytes", script_size + 3, MAX_SCRIPT_ELEMENT_SIZE);
846846
return nullptr;
847847
}
848848
}

src/test/fuzz/net.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ FUZZ_TARGET_INIT(net, initialize_net)
8585
}
8686
},
8787
[&] {
88-
// if (node.m_addr_known == nullptr) {
89-
// return;
90-
// }
88+
if (node.m_addr_known == nullptr) {
89+
return;
90+
}
9191
const std::optional<CAddress> addr_opt = ConsumeDeserializable<CAddress>(fuzzed_data_provider);
9292
if (!addr_opt) {
9393
return;
9494
}
9595
node.AddAddressKnown(*addr_opt);
9696
},
9797
[&] {
98-
// if (node.m_addr_known == nullptr) {
99-
// return;
100-
// }
98+
if (node.m_addr_known == nullptr) {
99+
return;
100+
}
101101
const std::optional<CAddress> addr_opt = ConsumeDeserializable<CAddress>(fuzzed_data_provider);
102102
if (!addr_opt) {
103103
return;

src/test/util_tests.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@ BOOST_FIXTURE_TEST_CASE(util_ChainMerge, ChainMergeTestingSetup)
988988
desc += " ";
989989
desc += argstr + 1;
990990
conf += argstr + 1;
991+
conf += "\n";
991992
}
992993
std::istringstream conf_stream(conf);
993994
BOOST_CHECK(parser.ReadConfigStream(conf_stream, "filepath", error));
@@ -1026,7 +1027,7 @@ BOOST_FIXTURE_TEST_CASE(util_ChainMerge, ChainMergeTestingSetup)
10261027
// Results file is formatted like:
10271028
//
10281029
// <input> || <output>
1029-
BOOST_CHECK_EQUAL(out_sha_hex, "3e70723862e346ed6e9b48d8efa13d4d56334c0b73fbf3c3a6ac8b8f4d914f65");
1030+
BOOST_CHECK_EQUAL(out_sha_hex, "f8cff01ad967dfc82cf71208aa2b60f01a0aa621c28356af5ca91d1d7370c217");
10301031
}
10311032

10321033
BOOST_AUTO_TEST_CASE(util_ReadWriteSettings)

0 commit comments

Comments
 (0)