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

Sigma pool closed, Extra payload extended #1477

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions src/consensus/consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ static const unsigned int MAX_BLOCK_BASE_SIZE = 2000000;
static const int64_t MAX_BLOCK_SIGOPS_COST = 400000;
/** The maximum allowed size of version 3 extra payload */
static const unsigned int MAX_TX_EXTRA_PAYLOAD = 150000;
static const unsigned int NEW_MAX_TX_EXTRA_PAYLOAD = 230000;
/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
static const int COINBASE_MATURITY = 100;

Expand Down
7 changes: 7 additions & 0 deletions src/lelantus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,13 @@ bool CheckLelantusJoinSplitTransaction(
"CTransaction::CheckLelantusJoinSplitTransaction() : Error: incorrect joinsplit transaction verion");
}

if (joinsplit->isSigmaToLelantus() && height >= params.stage4StartBlock) {
return state.DoS(100,
false,
NSEQUENCE_INCORRECT,
"CTransaction::CheckLelantusJoinSplitTransaction() : Sigma pool already closed.");
}

uint256 txHashForMetadata;

// Obtain the hash of the transaction sans the zerocoin part
Expand Down
7 changes: 6 additions & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ bool CheckTransaction(const CTransaction &tx, CValidationState &state, bool fChe
// Size limits (this doesn't take the witness into account, as that hasn't been checked for malleability)
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) > MAX_BLOCK_BASE_SIZE)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");
if (tx.vExtraPayload.size() > MAX_TX_EXTRA_PAYLOAD)
if ((tx.vExtraPayload.size() > MAX_TX_EXTRA_PAYLOAD && nHeight < ::Params().GetConsensus().stage4StartBlock) || tx.vExtraPayload.size() > NEW_MAX_TX_EXTRA_PAYLOAD)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-payload-oversize");

// Check for negative or overflow output values
Expand Down Expand Up @@ -964,6 +964,11 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
const std::vector<uint32_t> &ids = joinsplit->getCoinGroupIds();
const std::vector<Scalar>& serials = joinsplit->getCoinSerialNumbers();

if (joinsplit->isSigmaToLelantus() && chainActive.Height() >= consensus.stage4StartBlock) {
return state.DoS(100, error("Sigma pool already closed."),
REJECT_INVALID, "txn-invalid-lelantus-joinsplit");
}

if (serials.size() != ids.size())
return state.Invalid(false, REJECT_CONFLICT, "txn-invalid-lelantus-joinsplit");

Expand Down
3 changes: 3 additions & 0 deletions src/wallet/lelantusjoinsplitbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ CWalletTx LelantusJoinSplitBuilder::Build(

std::vector<sigma::CoinDenomination> denomChanges;
try {
if (chainActive.Height() >= Params().GetConsensus().stage4StartBlock)
throw std::runtime_error(_("Sigma pool already closed."));

CAmount availableBalance(0);
for (auto coin : sigmaCoins) {
availableBalance += coin.get_denomination_value();
Expand Down
Loading