Skip to content

Commit 5c0fb8f

Browse files
authored
Merge pull request #1431 from psgreco/elem-23.3.0rc5
Prepare 23.3.0rc5
2 parents f4e65b1 + 30eeffd commit 5c0fb8f

27 files changed

Lines changed: 115 additions & 88 deletions

build_msvc/bitcoind/bitcoind.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@
5757
<Target Name="AfterBuild">
5858
<Copy SourceFiles="$(ConfigIniIn)" DestinationFiles="$(ConfigIniOut)" ></Copy>
5959
<ReplaceInFile FilePath="$(ConfigIniOut)"
60-
Replace="@PACKAGE_NAME@" By="Bitcoin Core"></ReplaceInFile>
60+
Replace="@PACKAGE_NAME@" By="Elements Core"></ReplaceInFile>
6161
<ReplaceInFile FilePath="$(ConfigIniOut)"
62-
Replace="@PACKAGE_BUGREPORT@" By="https://github.com/bitcoin/bitcoin/issues"></ReplaceInFile>
62+
Replace="@PACKAGE_BUGREPORT@" By="https://github.com/ElementsProject/elements/issues"></ReplaceInFile>
6363
<ReplaceInFile FilePath="$(ConfigIniOut)"
6464
Replace="@abs_top_srcdir@" By="..\.." ToFullPath="true"></ReplaceInFile>
6565
<ReplaceInFile FilePath="$(ConfigIniOut)"

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ AC_PREREQ([2.69])
22
define(_CLIENT_VERSION_MAJOR, 23)
33
define(_CLIENT_VERSION_MINOR, 3)
44
define(_CLIENT_VERSION_BUILD, 0)
5-
define(_CLIENT_VERSION_RC, 4)
5+
define(_CLIENT_VERSION_RC, 5)
66
define(_CLIENT_VERSION_IS_RELEASE, true)
77
define(_COPYRIGHT_YEAR, 2024)
88
define(_COPYRIGHT_HOLDERS,[The %s developers])

src/block_proof.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static bool CheckProofGeneric(const CBlockHeader& block, const uint32_t max_bloc
4343
| SCRIPT_VERIFY_SIGPUSHONLY // Witness is push-only
4444
| SCRIPT_VERIFY_LOW_S // Stop easiest signature fiddling
4545
| SCRIPT_VERIFY_WITNESS // Witness and to enforce cleanstack
46-
| (is_dyna ? 0 : SCRIPT_NO_SIGHASH_BYTE); // Non-dynafed blocks do not have sighash byte
46+
| (is_dyna ? SCRIPT_VERIFY_NONE : SCRIPT_NO_SIGHASH_BYTE); // Non-dynafed blocks do not have sighash byte
4747
return GenericVerifyScript(scriptSig, witness, challenge, proof_flags, block);
4848
}
4949

src/net_processing.cpp

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,29 +2131,30 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
21312131
// If we are already too far ahead of where we want to be on headers, discard
21322132
// the received headers. We can still get ahead by up to a single maximum-sized
21332133
// headers message here, but never further, so that's fine.
2134-
if (pindexBestHeader) {
2135-
int64_t headers_ahead = pindexBestHeader->nHeight - m_chainman.ActiveHeight();
2136-
bool too_far_ahead = node::fTrimHeaders && (headers_ahead >= node::nHeaderDownloadBuffer);
2137-
if (too_far_ahead) {
2138-
LOCK(cs_main);
2139-
CNodeState *nodestate = State(pfrom.GetId());
2140-
if ((nodestate->pindexBestKnownBlock == nullptr) ||
2134+
if (node::fTrimHeaders) {
2135+
LOCK(cs_main);
2136+
if (pindexBestHeader) {
2137+
int64_t headers_ahead = pindexBestHeader->nHeight - m_chainman.ActiveHeight();
2138+
if (headers_ahead >= node::nHeaderDownloadBuffer) {
2139+
CNodeState *nodestate = State(pfrom.GetId());
2140+
if ((nodestate->pindexBestKnownBlock == nullptr) ||
21412141
(nodestate->pindexBestKnownBlock->nHeight < m_chainman.ActiveHeight())) {
2142-
// Our notion of what blocks a peer has available is based on its pindexBestKnownBlock,
2143-
// which is based on headers received from it. If we don't have one, or it's too old,
2144-
// then we can never get blocks from this peer until we accept headers from it first.
2145-
LogPrint(BCLog::NET, "NOT discarding headers from peer=%d, to update its block availability. (current best header %d, active chain height %d)\n", pfrom.GetId(), pindexBestHeader->nHeight, m_chainman.ActiveHeight());
2146-
} else {
2147-
LogPrint(BCLog::NET, "Discarding received headers and pausing header sync from peer=%d, because we are too far ahead of block sync. (%d > %d)\n", pfrom.GetId(), pindexBestHeader->nHeight, m_chainman.ActiveHeight());
2148-
if (nodestate->fSyncStarted) {
2149-
// Cancel sync from this node, so we don't penalize it later.
2150-
// This will cause us to automatically start syncing from a different node (or restart syncing from the same node) later,
2151-
// if we still need to sync headers.
2152-
nSyncStarted--;
2153-
nodestate->fSyncStarted = false;
2154-
nodestate->m_headers_sync_timeout = 0us;
2142+
// Our notion of what blocks a peer has available is based on its pindexBestKnownBlock,
2143+
// which is based on headers received from it. If we don't have one, or it's too old,
2144+
// then we can never get blocks from this peer until we accept headers from it first.
2145+
LogPrint(BCLog::NET, "NOT discarding headers from peer=%d, to update its block availability. (current best header %d, active chain height %d)\n", pfrom.GetId(), pindexBestHeader->nHeight, m_chainman.ActiveHeight());
2146+
} else {
2147+
LogPrint(BCLog::NET, "Discarding received headers and pausing header sync from peer=%d, because we are too far ahead of block sync. (%d > %d)\n", pfrom.GetId(), pindexBestHeader->nHeight, m_chainman.ActiveHeight());
2148+
if (nodestate->fSyncStarted) {
2149+
// Cancel sync from this node, so we don't penalize it later.
2150+
// This will cause us to automatically start syncing from a different node (or restart syncing from the same node) later,
2151+
// if we still need to sync headers.
2152+
nSyncStarted--;
2153+
nodestate->fSyncStarted = false;
2154+
nodestate->m_headers_sync_timeout = 0us;
2155+
}
2156+
return;
21552157
}
2156-
return;
21572158
}
21582159
}
21592160
}

src/primitives/confidential.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class CConfidentialValue : public CConfidentialCommitment<9, 8, 9>
149149
return -1;
150150
}
151151

152-
assert(IsExplicit());;
152+
assert(IsExplicit());
153153
return ReadBE64(&vchCommitment[1]);
154154
}
155155
void SetToAmount(CAmount nAmount);

src/rpc/request.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ static fs::path GetMainchainAuthCookieFile()
139139
if (gArgs.GetChainName() == "liquidv1") {
140140
cookie_file = ".cookie";
141141
}
142-
return fsbridge::AbsPathJoin(GetMainchainDefaultDataDir(), fs::PathFromString(gArgs.GetArg("-mainchainrpccookiefile", cookie_file)));
142+
fs::path cookie_path = fs::PathFromString(gArgs.GetArg("-mainchainrpccookiefile", cookie_file));
143+
if (cookie_path.is_absolute())
144+
return cookie_path;
145+
return fsbridge::AbsPathJoin(GetMainchainDefaultDataDir(), cookie_path);
143146
}
144147

145148
bool GetMainchainAuthCookie(std::string *cookie_out)
@@ -148,7 +151,7 @@ bool GetMainchainAuthCookie(std::string *cookie_out)
148151
std::string cookie;
149152

150153
std::filesystem::path filepath = GetMainchainAuthCookieFile();
151-
file.open(filepath.string().c_str());
154+
file.open(filepath);
152155
if (!file.is_open())
153156
return false;
154157
std::getline(file, cookie);

src/script/interpreter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,7 +2669,7 @@ void PrecomputedTransactionData::Init(const T& txTo, std::vector<CTxOut>&& spent
26692669
simplicityRawTx.version = txTo.nVersion;
26702670
simplicityRawTx.lockTime = txTo.nLockTime;
26712671

2672-
m_simplicity_tx_data = simplicity_elements_mallocTransaction(&simplicityRawTx);
2672+
m_simplicity_tx_data = SimplicityTransactionUniquePtr(simplicity_elements_mallocTransaction(&simplicityRawTx));
26732673

26742674
m_bip341_taproot_ready = true;
26752675
}
@@ -3121,7 +3121,7 @@ bool GenericTransactionSignatureChecker<T>::CheckSimplicity(const valtype& progr
31213121

31223122
assert(txdata->m_simplicity_tx_data);
31233123
assert(simplicityTapEnv);
3124-
if (!simplicity_elements_execSimplicity(&error, 0, txdata->m_simplicity_tx_data, nIn, simplicityTapEnv, txdata->m_hash_genesis_block.data(), budget, 0, program.data(), program.size(), witness.data(), witness.size())) {
3124+
if (!simplicity_elements_execSimplicity(&error, 0, txdata->m_simplicity_tx_data.get(), nIn, simplicityTapEnv, txdata->m_hash_genesis_block.data(), budget, 0, program.data(), program.size(), witness.data(), witness.size())) {
31253125
assert(!"simplicity_elements_execSimplicity internal error");
31263126
}
31273127
simplicity_elements_freeTapEnv(simplicityTapEnv);

src/script/interpreter.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,18 @@ enum : uint32_t {
169169

170170
bool CheckSignatureEncoding(const std::vector<unsigned char> &vchSig, unsigned int flags, ScriptError* serror);
171171

172+
struct SimplicityTransactionDeleter
173+
{
174+
void operator()(transaction* ptr)
175+
{
176+
simplicity_elements_freeTransaction(ptr);
177+
}
178+
};
179+
using SimplicityTransactionUniquePtr = std::unique_ptr<transaction, SimplicityTransactionDeleter>;
180+
172181
struct PrecomputedTransactionData
173182
{
174-
transaction* m_simplicity_tx_data = nullptr;
183+
SimplicityTransactionUniquePtr m_simplicity_tx_data;
175184
// BIP341 precomputed data.
176185
// These are single-SHA256, see https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#cite_note-15.
177186
uint256 m_prevouts_single_hash;
@@ -221,9 +230,6 @@ struct PrecomputedTransactionData
221230

222231
template <class T>
223232
explicit PrecomputedTransactionData(const T& tx);
224-
~PrecomputedTransactionData() {
225-
simplicity_elements_freeTransaction(m_simplicity_tx_data);
226-
}
227233
};
228234

229235
enum class SigVersion

src/simplicity/dag.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ void simplicity_computeAnnotatedMerkleRoot(analyses* analysis, const dag_node* d
367367
}
368368

369369
/* Verifies that the 'dag' is in canonical order, meaning that nodes under the left branches have lower indices than nodes under
370-
* right branches, with the exception that nodes under right braches may (cross-)reference identical nodes that already occur under
370+
* right branches, with the exception that nodes under right branches may (cross-)reference identical nodes that already occur under
371371
* left branches.
372372
*
373373
* Returns 'SIMPLICITY_NO_ERROR' if the 'dag' is in canonical order, and returns 'SIMPLICITY_ERR_DATA_OUT_OF_ORDER' if it is not.
@@ -389,7 +389,7 @@ simplicity_err simplicity_verifyCanonicalOrder(dag_node* dag, const uint_fast32_
389389
/* We use dag[i].aux as a "stack" to manage the traversal of the DAG. */
390390
dag[top].aux = len; /* We will set top to 'len' to indicate we are finished. */
391391

392-
/* Each time any particular 'top' value is revisted in this loop, bottom has increased to be strictly larger than the last 'child'
392+
/* Each time any particular 'top' value is revisited in this loop, bottom has increased to be strictly larger than the last 'child'
393393
value examined. Therefore we will make further progress in the loop the next time around.
394394
By this reasoning any given 'top' value will be visited no more than numChildren(dag[top].tag) + 1 <= 3 times.
395395
Thus this loop iterates at most O('len') times.

src/simplicity/dag.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ void simplicity_computeCommitmentMerkleRoot(dag_node* dag, uint_fast32_t i);
350350
void simplicity_computeAnnotatedMerkleRoot(analyses* analysis, const dag_node* dag, const type* type_dag, uint_fast32_t len);
351351

352352
/* Verifies that the 'dag' is in canonical order, meaning that nodes under the left branches have lower indices than nodes under
353-
* right branches, with the exception that nodes under right braches may (cross-)reference identical nodes that already occur under
353+
* right branches, with the exception that nodes under right branches may (cross-)reference identical nodes that already occur under
354354
* left branches.
355355
*
356356
* Returns 'SIMPLICITY_NO_ERROR' if the 'dag' is in canonical order, and returns 'SIMPLICITY_ERR_DATA_OUT_OF_ORDER' if it is not.

0 commit comments

Comments
 (0)