Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/26.x' into 26.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Nov 1, 2023
2 parents 991eabd + 67b2512 commit 6381723
Show file tree
Hide file tree
Showing 19 changed files with 131 additions and 42 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ([2.69])
define(_CLIENT_VERSION_MAJOR, 26)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 1)
define(_CLIENT_VERSION_RC, 2)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2023)
define(_COPYRIGHT_HOLDERS,[The %s developers])
Expand Down
6 changes: 5 additions & 1 deletion contrib/guix/libexec/codesign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ mkdir -p "$DISTSRC"
signapple apply dist/Groestlcoin-Qt.app codesignatures/osx/dist

# Make a .zip from dist/
zip "${OUTDIR}/${DISTNAME}-${HOST}.zip" dist/*
cd dist/
find . -print0 \
| xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}"
find . | sort \
| zip -X@ "${OUTDIR}/${DISTNAME}-${HOST}.zip"
;;
*)
exit 1
Expand Down
6 changes: 2 additions & 4 deletions contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
((gnu packages python) #:select (python-minimal))
((gnu packages python-build) #:select (python-tomli))
((gnu packages python-crypto) #:select (python-asn1crypto))
((gnu packages python-web) #:select (python-requests))
((gnu packages tls) #:select (openssl))
((gnu packages version-control) #:select (git-minimal))
(guix build-system cmake)
Expand Down Expand Up @@ -445,7 +444,7 @@ and endian independent.")
(license license:expat)))

(define-public python-signapple
(let ((commit "8a945a2e7583be2665cf3a6a89d665b70ecd1ab6"))
(let ((commit "7a96b4171a360abf0f0f56e499f8f9ed2116280d"))
(package
(name "python-signapple")
(version (git-version "0.1" "1" commit))
Expand All @@ -458,14 +457,13 @@ and endian independent.")
(file-name (git-file-name name commit))
(sha256
(base32
"0fr1hangvfyiwflca6jg5g8zvg3jc9qr7vd2c12ff89pznf38dlg"))))
"0aa4k180jnpal15yhncnm3g3z9gzmi7qb25q5l0kaj444a1p2pm4"))))
(build-system python-build-system)
(propagated-inputs
`(("python-asn1crypto" ,python-asn1crypto)
("python-oscrypto" ,python-oscrypto)
("python-certvalidator" ,python-certvalidator)
("python-elfesteem" ,python-elfesteem)
("python-requests" ,python-requests)
("python-macholib" ,python-macholib)))
;; There are no tests, but attempting to run python setup.py test leads to
;; problems, just disable the test
Expand Down
8 changes: 4 additions & 4 deletions doc/man/groestlcoin-cli.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH GROESTLCOIN-CLI "1" "October 2023" "groestlcoin-cli v26.0.0rc1" "User Commands"
.TH GROESTLCOIN-CLI "1" "October 2023" "groestlcoin-cli v26.0.0rc2" "User Commands"
.SH NAME
groestlcoin-cli \- manual page for groestlcoin-cli v26.0.0rc1
groestlcoin-cli \- manual page for groestlcoin-cli v26.0.0rc2
.SH SYNOPSIS
.B groestlcoin-cli
[\fI\,options\/\fR] \fI\,<command> \/\fR[\fI\,params\/\fR] \fI\,Send command to Groestlcoin Core\/\fR
Expand All @@ -15,7 +15,7 @@ groestlcoin-cli \- manual page for groestlcoin-cli v26.0.0rc1
.B groestlcoin-cli
[\fI\,options\/\fR] \fI\,help <command> Get help for a command\/\fR
.SH DESCRIPTION
Groestlcoin Core RPC client version v26.0.0rc1
Groestlcoin Core RPC client version v26.0.0rc2
.SH OPTIONS
.HP
\-?
Expand Down Expand Up @@ -179,4 +179,4 @@ The source code is available from <https://github.com/Groestlcoin/groestlcoin>.

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>
or <https://opensource.org/licenses/MIT>
8 changes: 4 additions & 4 deletions doc/man/groestlcoin-qt.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH GROESTLCOIN-QT "1" "October 2023" "groestlcoin-qt v26.0.0rc1" "User Commands"
.TH GROESTLCOIN-QT "1" "October 2023" "groestlcoin-qt v26.0.0rc2" "User Commands"
.SH NAME
groestlcoin-qt \- manual page for groestlcoin-qt v26.0.0rc1
groestlcoin-qt \- manual page for groestlcoin-qt v26.0.0rc2
.SH SYNOPSIS
.B groestlcoin-qt
[\fI\,command-line options\/\fR]
.SH DESCRIPTION
Groestlcoin Core versie v26.0.0rc1
Groestlcoin Core versie v26.0.0rc2
.SH OPTIONS
.HP
\-?
Expand Down Expand Up @@ -820,4 +820,4 @@ The source code is available from <https://github.com/Groestlcoin/groestlcoin>.

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>
or <https://opensource.org/licenses/MIT>
8 changes: 4 additions & 4 deletions doc/man/groestlcoin-tx.1
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH GROESTLCOIN-TX "1" "October 2023" "groestlcoin-tx v26.0.0rc1" "User Commands"
.TH GROESTLCOIN-TX "1" "October 2023" "groestlcoin-tx v26.0.0rc2" "User Commands"
.SH NAME
groestlcoin-tx \- manual page for groestlcoin-tx v26.0.0rc1
groestlcoin-tx \- manual page for groestlcoin-tx v26.0.0rc2
.SH SYNOPSIS
.B groestlcoin-tx
[\fI\,options\/\fR] \fI\,<hex-tx> \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded groestlcoin transaction\/\fR
.br
.B groestlcoin-tx
[\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] \fI\,Create hex-encoded groestlcoin transaction\/\fR
.SH DESCRIPTION
Groestlcoin Core groestlcoin\-tx utility version v26.0.0rc1
Groestlcoin Core groestlcoin\-tx utility version v26.0.0rc2
.SH OPTIONS
.HP
\-?
Expand Down Expand Up @@ -143,4 +143,4 @@ The source code is available from <https://github.com/Groestlcoin/groestlcoin>.

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>
or <https://opensource.org/licenses/MIT>
8 changes: 4 additions & 4 deletions doc/man/groestlcoin-util.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH GROESTLCOIN-UTIL "1" "October 2023" "groestlcoin-util v26.0.0rc1" "User Commands"
.TH GROESTLCOIN-UTIL "1" "October 2023" "groestlcoin-util v26.0.0rc2" "User Commands"
.SH NAME
groestlcoin-util \- manual page for groestlcoin-util v26.0.0rc1
groestlcoin-util \- manual page for groestlcoin-util v26.0.0rc2
.SH SYNOPSIS
.B groestlcoin-util
[\fI\,options\/\fR] [\fI\,commands\/\fR] \fI\,Do stuff\/\fR
.SH DESCRIPTION
Groestlcoin Core groestlcoin\-util utility version v26.0.0rc1
Groestlcoin Core groestlcoin\-util utility version v26.0.0rc2
.SH OPTIONS
.HP
\-?
Expand Down Expand Up @@ -63,4 +63,4 @@ The source code is available from <https://github.com/Groestlcoin/groestlcoin>.

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>
or <https://opensource.org/licenses/MIT>
8 changes: 4 additions & 4 deletions doc/man/groestlcoin-wallet.1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH GROESTLCOIN-WALLET "1" "October 2023" "groestlcoin-wallet v26.0.0rc1" "User Commands"
.TH GROESTLCOIN-WALLET "1" "October 2023" "groestlcoin-wallet v26.0.0rc2" "User Commands"
.SH NAME
groestlcoin-wallet \- manual page for groestlcoin-wallet v26.0.0rc1
groestlcoin-wallet \- manual page for groestlcoin-wallet v26.0.0rc2
.SH DESCRIPTION
Groestlcoin Core groestlcoin\-wallet version v26.0.0rc1
Groestlcoin Core groestlcoin\-wallet version v26.0.0rc2
.PP
groestlcoin\-wallet is an offline tool for creating and interacting with Groestlcoin Core wallet files.
By default groestlcoin\-wallet will act on wallets in the default mainnet wallet directory in the datadir.
Expand Down Expand Up @@ -119,4 +119,4 @@ The source code is available from <https://github.com/Groestlcoin/groestlcoin>.

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>
or <https://opensource.org/licenses/MIT>
8 changes: 4 additions & 4 deletions doc/man/groestlcoind.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH GROESTLCOIND "1" "October 2023" "groestlcoind v26.0.0rc1" "User Commands"
.TH GROESTLCOIND "1" "October 2023" "groestlcoind v26.0.0rc2" "User Commands"
.SH NAME
groestlcoind \- manual page for groestlcoind v26.0.0rc1
groestlcoind \- manual page for groestlcoind v26.0.0rc2
.SH SYNOPSIS
.B groestlcoind
[\fI\,options\/\fR] \fI\,Start Groestlcoin Core\/\fR
.SH DESCRIPTION
Groestlcoin Core version v26.0.0rc1
Groestlcoin Core version v26.0.0rc2
.SH OPTIONS
.HP
\-?
Expand Down Expand Up @@ -798,4 +798,4 @@ The source code is available from <https://github.com/Groestlcoin/groestlcoin>.

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <https://opensource.org/licenses/MIT>
or <https://opensource.org/licenses/MIT>
9 changes: 5 additions & 4 deletions src/addresstype.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
#include <variant>
#include <algorithm>

class CNoDestination {
class CNoDestination
{
private:
CScript m_script;

public:
CNoDestination() = default;
CNoDestination(const CScript& script) : m_script(script) {}
explicit CNoDestination(const CScript& script) : m_script(script) {}

const CScript& GetScript() const { return m_script; }
const CScript& GetScript() const LIFETIMEBOUND { return m_script; }

friend bool operator==(const CNoDestination& a, const CNoDestination& b) { return a.GetScript() == b.GetScript(); }
friend bool operator<(const CNoDestination& a, const CNoDestination& b) { return a.GetScript() < b.GetScript(); }
Expand All @@ -32,7 +33,7 @@ struct PubKeyDestination {
CPubKey m_pubkey;

public:
PubKeyDestination(const CPubKey& pubkey) : m_pubkey(pubkey) {}
explicit PubKeyDestination(const CPubKey& pubkey) : m_pubkey(pubkey) {}

const CPubKey& GetPubKey() const LIFETIMEBOUND { return m_pubkey; }

Expand Down
7 changes: 4 additions & 3 deletions src/bench/wallet_create_tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,14 @@ static void WalletCreateTx(benchmark::Bench& bench, const OutputType output_type
}

// Generate destinations
CScript dest = GetScriptForDestination(getNewDestination(wallet, output_type));
const auto dest{getNewDestination(wallet, output_type)};

// Generate chain; each coinbase will have two outputs to fill-up the wallet
const auto& params = Params();
const CScript coinbase_out{GetScriptForDestination(dest)};
unsigned int chain_size = 5000; // 5k blocks means 10k UTXO for the wallet (minus 200 due COINBASE_MATURITY)
for (unsigned int i = 0; i < chain_size; ++i) {
generateFakeBlock(params, test_setup->m_node, wallet, dest);
generateFakeBlock(params, test_setup->m_node, wallet, coinbase_out);
}

// Check available balance
Expand Down Expand Up @@ -185,4 +186,4 @@ static void WalletAvailableCoins(benchmark::Bench& bench) { AvailableCoins(bench

BENCHMARK(WalletCreateTxUseOnlyPresetInputs, benchmark::PriorityLevel::LOW)
BENCHMARK(WalletCreateTxUsePresetInputsAndCoinSelection, benchmark::PriorityLevel::LOW)
BENCHMARK(WalletAvailableCoins, benchmark::PriorityLevel::LOW);
BENCHMARK(WalletAvailableCoins, benchmark::PriorityLevel::LOW);
15 changes: 15 additions & 0 deletions src/i2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,26 @@ Binary Session::MyDestination() const
static constexpr size_t CERT_LEN_POS = 385;

uint16_t cert_len;

if (m_private_key.size() < CERT_LEN_POS + sizeof(cert_len)) {
throw std::runtime_error(strprintf("The private key is too short (%d < %d)",
m_private_key.size(),
CERT_LEN_POS + sizeof(cert_len)));
}

memcpy(&cert_len, &m_private_key.at(CERT_LEN_POS), sizeof(cert_len));
cert_len = be16toh(cert_len);

const size_t dest_len = DEST_LEN_BASE + cert_len;

if (dest_len > m_private_key.size()) {
throw std::runtime_error(strprintf("Certificate length (%d) designates that the private key should "
"be %d bytes, but it is only %d bytes",
cert_len,
dest_len,
m_private_key.size()));
}

return Binary{m_private_key.begin(), m_private_key.begin() + dest_len};
}

Expand Down
7 changes: 6 additions & 1 deletion src/node/blockstorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,12 @@ bool BlockManager::LoadBlockIndex(const std::optional<uint256>& snapshot_blockha
}

if (snapshot_blockhash) {
const AssumeutxoData au_data = *Assert(GetParams().AssumeutxoForBlockhash(*snapshot_blockhash));
const std::optional<AssumeutxoData> maybe_au_data = GetParams().AssumeutxoForBlockhash(*snapshot_blockhash);
if (!maybe_au_data) {
m_opts.notifications.fatalError(strprintf("Assumeutxo data not found for the given blockhash '%s'.", snapshot_blockhash->ToString()));
return false;
}
const AssumeutxoData& au_data = *Assert(maybe_au_data);
m_snapshot_height = au_data.height;
CBlockIndex* base{LookupBlockIndex(*snapshot_blockhash)};

Expand Down
3 changes: 3 additions & 0 deletions src/qt/transactionview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ void TransactionView::showDetails()
TransactionDescDialog *dlg = new TransactionDescDialog(selection.at(0));
dlg->setAttribute(Qt::WA_DeleteOnClose);
m_opened_dialogs.append(dlg);
connect(dlg, &QObject::destroyed, [this, dlg] {
m_opened_dialogs.removeOne(dlg);
});
dlg->show();
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
setAddress.insert(rcp.address);
++nAddresses;

CScript scriptPubKey = GetScriptForDestination(DecodeDestination(rcp.address.toStdString()));
CRecipient recipient = {scriptPubKey, rcp.amount, rcp.fSubtractFeeFromAmount};
CRecipient recipient{DecodeDestination(rcp.address.toStdString()), rcp.amount, rcp.fSubtractFeeFromAmount};
vecSend.push_back(recipient);

total += rcp.amount;
Expand Down
44 changes: 44 additions & 0 deletions src/test/i2p_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <test/util/logging.h>
#include <test/util/net.h>
#include <test/util/setup_common.h>
#include <util/readwritefile.h>
#include <util/threadinterrupt.h>

#include <boost/test/unit_test.hpp>
Expand Down Expand Up @@ -125,4 +126,47 @@ BOOST_AUTO_TEST_CASE(listen_ok_accept_fail)
}
}

BOOST_AUTO_TEST_CASE(damaged_private_key)
{
const auto CreateSockOrig = CreateSock;

CreateSock = [](const CService&) {
return std::make_unique<StaticContentsSock>("HELLO REPLY RESULT=OK VERSION=3.1\n"
"SESSION STATUS RESULT=OK DESTINATION=\n");
};

const auto i2p_private_key_file = m_args.GetDataDirNet() / "test_i2p_private_key_damaged";

for (const auto& [file_contents, expected_error] : std::vector<std::tuple<std::string, std::string>>{
{"", "The private key is too short (0 < 387)"},

{"abcd", "The private key is too short (4 < 387)"},

{std::string(386, '\0'), "The private key is too short (386 < 387)"},

{std::string(385, '\0') + '\0' + '\1',
"Certificate length (1) designates that the private key should be 388 bytes, but it is only "
"387 bytes"},

{std::string(385, '\0') + '\0' + '\5' + "abcd",
"Certificate length (5) designates that the private key should be 392 bytes, but it is only "
"391 bytes"}}) {
BOOST_REQUIRE(WriteBinaryFile(i2p_private_key_file, file_contents));

CThreadInterrupt interrupt;
i2p::sam::Session session(i2p_private_key_file, CService{}, &interrupt);

{
ASSERT_DEBUG_LOG("Creating persistent SAM session");
ASSERT_DEBUG_LOG(expected_error);

i2p::Connection conn;
bool proxy_error;
BOOST_CHECK(!session.Connect(CService{}, conn, proxy_error));
}
}

CreateSock = CreateSockOrig;
}

BOOST_AUTO_TEST_SUITE_END()
2 changes: 1 addition & 1 deletion src/wallet/test/spend_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ BOOST_FIXTURE_TEST_CASE(wallet_duplicated_preset_inputs_test, TestChain100Setup)

// Try to create a tx that spends more than what preset inputs + wallet selected inputs are covering for.
// The wallet can cover up to 200 BTC, and the tx target is 299 BTC.
std::vector<CRecipient> recipients = {{GetScriptForDestination(*Assert(wallet->GetNewDestination(OutputType::BECH32, "dummy"))),
std::vector<CRecipient> recipients{{*Assert(wallet->GetNewDestination(OutputType::BECH32, "dummy")),
/*nAmount=*/299 * COIN, /*fSubtractFeeFromAmount=*/true}};
CCoinControl coin_control;
coin_control.m_allow_other_inputs = true;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/test/wallet_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ BOOST_FIXTURE_TEST_CASE(ListCoinsTest, ListCoinsTestingSetup)
// returns the coin associated with the change address underneath the
// coinbaseKey pubkey, even though the change address has a different
// pubkey.
AddTx(CRecipient{GetScriptForRawPubKey({}), 1 * COIN, /*subtract_fee=*/false});
AddTx(CRecipient{PubKeyDestination{{}}, 1 * COIN, /*subtract_fee=*/false});
{
LOCK(wallet->cs_wallet);
list = ListCoins(*wallet);
Expand Down
Loading

0 comments on commit 6381723

Please sign in to comment.