Merge pull request #12 from palladium-coin/logic-improvements

Logic improvements
This commit is contained in:
NotRin7
2025-11-22 20:07:33 +01:00
committed by GitHub
12 changed files with 123 additions and 27 deletions

View File

@@ -18,10 +18,10 @@
#define CLIENT_VERSION_MAJOR 1
/* Minor version */
#define CLIENT_VERSION_MINOR 4
#define CLIENT_VERSION_MINOR 5
/* Build revision */
#define CLIENT_VERSION_REVISION 3
#define CLIENT_VERSION_REVISION 0
/* Copyright holder(s) before %s replacement */
#define COPYRIGHT_HOLDERS "The %s developers"

View File

@@ -1,7 +1,7 @@
AC_PREREQ([2.69])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 4)
define(_CLIENT_VERSION_REVISION, 3)
define(_CLIENT_VERSION_MINOR, 5)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)

View File

@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
.TH PALLADIUM-CLI "1" "April 2024" "palladium-cli v1.4.3" "User Commands"
.TH PALLADIUM-CLI "1" "April 2024" "palladium-cli v1.5.0" "User Commands"
.SH NAME
palladium-cli \\- manual page for palladium-cli v1.4.3
palladium-cli \\- manual page for palladium-cli v1.5.0
.SH SYNOPSIS
.B palladium-cli
[\fI\,options\/\fR] \fI\,<command> \/\fR[\fI\,params\/\fR] \fI\,Send command to Palladium Core\/\fR
@@ -15,7 +15,7 @@ palladium-cli \\- manual page for palladium-cli v1.4.3
.B palladium-cli
[\fI\,options\/\fR] \fI\,help <command> Get help for a command\/\fR
.SH DESCRIPTION
Palladium Core RPC client version v1.4.3
Palladium Core RPC client version v1.5.0
.SH OPTIONS
.HP
\-?

View File

@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
.TH PALLADIUM-QT "1" "April 2024" "palladium-qt v1.4.3" "User Commands"
.TH PALLADIUM-QT "1" "April 2024" "palladium-qt v1.5.0" "User Commands"
.SH NAME
palladium-qt \\- manual page for palladium-qt v1.4.3
palladium-qt \\- manual page for palladium-qt v1.5.0
.SH SYNOPSIS
.B palladium-qt
[\fI\,command-line options\/\fR]
.SH DESCRIPTION
Palladium Core version v1.4.3
Palladium Core version v1.5.0
.SH OPTIONS
.HP
\-?

View File

@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
.TH PALLADIUM-TX "1" "April 2024" "palladium-tx v1.4.3" "User Commands"
.TH PALLADIUM-TX "1" "April 2024" "palladium-tx v1.5.0" "User Commands"
.SH NAME
palladium-tx \\- manual page for palladium-tx v1.4.3
palladium-tx \\- manual page for palladium-tx v1.5.0
.SH SYNOPSIS
.B palladium-tx
[\fI\,options\/\fR] \fI\,<hex-tx> \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded palladium transaction\/\fR
@@ -9,7 +9,7 @@ palladium-tx \\- manual page for palladium-tx v1.4.3
.B palladium-tx
[\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] \fI\,Create hex-encoded palladium transaction\/\fR
.SH DESCRIPTION
Palladium Core palladium\-tx utility version v1.4.3
Palladium Core palladium\-tx utility version v1.5.0
.SH OPTIONS
.HP
\-?

View File

@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
.TH PALLADIUM-WALLET "1" "April 2024" "palladium-wallet v1.4.3" "User Commands"
.TH PALLADIUM-WALLET "1" "April 2024" "palladium-wallet v1.5.0" "User Commands"
.SH NAME
palladium-wallet \\- manual page for palladium-wallet v1.4.3
palladium-wallet \\- manual page for palladium-wallet v1.5.0
.SH DESCRIPTION
Palladium Core palladium\-wallet version v1.4.3
Palladium Core palladium\-wallet version v1.5.0
.PP
palladium\-wallet is an offline tool for creating and interacting with Palladium Core wallet files.
By default palladium\-wallet will act on wallets in the default mainnet wallet directory in the datadir.

View File

@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
.TH PALLADIUMD "1" "April 2024" "palladiumd v1.4.3" "User Commands"
.TH PALLADIUMD "1" "April 2024" "palladiumd v1.5.0" "User Commands"
.SH NAME
palladiumd \\- manual page for palladiumd v1.4.3
palladiumd \\- manual page for palladiumd v1.5.0
.SH SYNOPSIS
.B palladiumd
[\fI\,options\/\fR] \fI\,Start Palladium Core\/\fR
.SH DESCRIPTION
Palladium Core version v1.4.3
Palladium Core version v1.5.0
.SH OPTIONS
.HP
\-?

View File

@@ -81,8 +81,8 @@ std::string FormatFullVersion()
{
// Display a simplified semantic version: omit trailing ".0" and git suffix
// by reusing FormatVersion on the aggregated CLIENT_VERSION.
// This yields e.g. "v1.4.3" when CLIENT_VERSION_BUILD == 0,
// or "v1.4.3.1" if a non-zero build number is used.
// This yields e.g. "v1.5.0" when CLIENT_VERSION_BUILD == 0,
// or "v1.5.0.1" if a non-zero build number is used.
return std::string("v") + FormatVersion(CLIENT_VERSION);
}

View File

@@ -28,6 +28,20 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
if (params.fPowAllowMinDifficultyBlocks && pindexLast->nHeight >= 0)
return LwmaCalculateNextWorkRequired(pindexLast, params);
// Palladium: Hard Fork at 350,000 for fast difficulty adjustment
if (pindexLast->nHeight + 1 >= 340000) {
int64_t nIntervalNew = 60;
if ((pindexLast->nHeight + 1) % nIntervalNew != 0)
return pindexLast->nBits;
int nHeightFirst = pindexLast->nHeight - (nIntervalNew - 1);
assert(nHeightFirst >= 0);
const CBlockIndex* pindexFirst = pindexLast->GetAncestor(nHeightFirst);
assert(pindexFirst);
return CalculateNextWorkRequired(pindexLast, pindexFirst->GetBlockTime(), params);
}
if (pindexLast->nHeight >= 29000)
return LwmaCalculateNextWorkRequired(pindexLast, params);
@@ -110,19 +124,25 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF
if (params.fPowNoRetargeting)
return pindexLast->nBits;
// Palladium: Hard Fork at 350,000 for fast difficulty adjustment
int64_t nTargetTimespan = params.nPowTargetTimespan;
if (pindexLast->nHeight + 1 >= 340000) {
nTargetTimespan = 7200; // 60 blocks * 120 seconds
}
// Limit adjustment step
int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
if (nActualTimespan < params.nPowTargetTimespan/4)
nActualTimespan = params.nPowTargetTimespan/4;
if (nActualTimespan > params.nPowTargetTimespan*4)
nActualTimespan = params.nPowTargetTimespan*4;
if (nActualTimespan < nTargetTimespan/4)
nActualTimespan = nTargetTimespan/4;
if (nActualTimespan > nTargetTimespan*4)
nActualTimespan = nTargetTimespan*4;
// Retarget
const arith_uint256 bnPowLimit = UintToArith256(params.powLimit);
arith_uint256 bnNew;
bnNew.SetCompact(pindexLast->nBits);
bnNew *= nActualTimespan;
bnNew /= params.nPowTargetTimespan;
bnNew /= nTargetTimespan;
if (bnNew > bnPowLimit)
bnNew = bnPowLimit;

View File

@@ -30,7 +30,7 @@ public:
* Default setting for nMaxDatacarrierBytes. 80 bytes of data, +1 for OP_RETURN,
* +2 for the pushdata opcodes.
*/
static const unsigned int MAX_OP_RETURN_RELAY = 83;
static const unsigned int MAX_OP_RETURN_RELAY = 520;
/**
* A data carrying output is an unspendable output containing data. The script

View File

@@ -563,6 +563,15 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
if (fRequireStandard && !IsStandardTx(tx, reason))
return state.Invalid(TxValidationResult::TX_NOT_STANDARD, reason);
// Check OP_RETURN size based on activation height
if (ChainActive().Height() < 340000) {
for (const CTxOut& txout : tx.vout) {
if (txout.scriptPubKey.IsUnspendable() && txout.scriptPubKey.size() > 83) {
return state.Invalid(TxValidationResult::TX_NOT_STANDARD, "bad-txns-oversize-opreturn-prefork");
}
}
}
// Do not work on transactions that are too small.
// A transaction with 1 segwit input and 1 P2WPHK output has non-witness size of 82 bytes.
// Transactions smaller than this are not relayed to mitigate CVE-2017-12842 by not relaying

67
update_version.sh Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/bash
set -e
echo "========================================================"
echo " Palladium Core - Master Version Updater"
echo "========================================================"
# 1. Get Inputs
read -p "Enter CURRENT version string (e.g. 1.4.3): " OLD_VERSION
read -p "Enter NEW version string (e.g. 1.5.0): " NEW_VERSION
if [ -z "$OLD_VERSION" ] || [ -z "$NEW_VERSION" ]; then
echo "Error: Version strings cannot be empty."
exit 1
fi
# Parse the NEW version into parts (Major.Minor.Revision)
IFS='.' read -r -a V_PARTS <<< "$NEW_VERSION"
MAJOR="${V_PARTS[0]}"
MINOR="${V_PARTS[1]}"
REV="${V_PARTS[2]}"
# Default to 0 if revision is missing (e.g. 1.5 becomes 1.5.0)
if [ -z "$REV" ]; then REV="0"; fi
echo "--------------------------------------------------------"
echo "Targeting: $MAJOR.$MINOR.$REV"
echo "--------------------------------------------------------"
# 2. Global Text Replacement (Docs, Manpages, Comments)
echo "[1/3] Performing global search & replace ($OLD_VERSION -> $NEW_VERSION)..."
# We exclude .git directory and binaries to avoid corruption
grep -rIl "$OLD_VERSION" . | grep -v "^./.git" | grep -v "update_version.sh" | while read -r file ; do
sed -i "s/$OLD_VERSION/$NEW_VERSION/g" "$file"
done
echo "Global text replacement done."
# 3. Update configure.ac (The Linux/Unix Build System)
echo "[2/3] Updating configure.ac..."
if [ -f "configure.ac" ]; then
sed -i "s/define(_CLIENT_VERSION_MAJOR, [0-9]*)/define(_CLIENT_VERSION_MAJOR, $MAJOR)/g" configure.ac
sed -i "s/define(_CLIENT_VERSION_MINOR, [0-9]*)/define(_CLIENT_VERSION_MINOR, $MINOR)/g" configure.ac
sed -i "s/define(_CLIENT_VERSION_REVISION, [0-9]*)/define(_CLIENT_VERSION_REVISION, $REV)/g" configure.ac
echo "✔ configure.ac updated."
else
echo "❌ Warning: configure.ac not found."
fi
# 4. Update Windows MSVC Config (The Windows Build System)
echo "[3/3] Updating build_msvc/palladium_config.h..."
MSVC_FILE="build_msvc/palladium_config.h"
if [ -f "$MSVC_FILE" ]; then
sed -i "s/#define CLIENT_VERSION_MAJOR [0-9]*/#define CLIENT_VERSION_MAJOR $MAJOR/g" "$MSVC_FILE"
sed -i "s/#define CLIENT_VERSION_MINOR [0-9]*/#define CLIENT_VERSION_MINOR $MINOR/g" "$MSVC_FILE"
sed -i "s/#define CLIENT_VERSION_REVISION [0-9]*/#define CLIENT_VERSION_REVISION $REV/g" "$MSVC_FILE"
echo "$MSVC_FILE updated."
else
echo "❌ Warning: $MSVC_FILE not found."
fi
echo "========================================================"
echo "Update Complete! Please run:"
echo "1. make clean"
echo "2. ./autogen.sh"
echo "3. ./configure"
echo "4. make"
echo "========================================================"