mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-04 09:16:47 +00:00
fix: allow pseudo-transactions to omit NetworkID (#4737)
The Network ID logic should not be applied to pseudo-transactions. This allows amendments to enable on a network with an ID > 1024. Context: - NetworkID: https://github.com/XRPLF/rippled/pull/4370 - Pseudo-transactions: https://xrpl.org/pseudo-transaction-types.html Fix #4736 --------- Co-authored-by: RichardAH <richard.holland@starstone.co.nz>
This commit is contained in:
@@ -40,25 +40,28 @@ namespace ripple {
|
||||
NotTEC
|
||||
preflight0(PreflightContext const& ctx)
|
||||
{
|
||||
uint32_t const nodeNID = ctx.app.config().NETWORK_ID;
|
||||
std::optional<uint32_t> const txNID = ctx.tx[~sfNetworkID];
|
||||
|
||||
if (nodeNID <= 1024)
|
||||
if (!isPseudoTx(ctx.tx) || ctx.tx.isFieldPresent(sfNetworkID))
|
||||
{
|
||||
// legacy networks have IDs 1024 and below. These networks cannot
|
||||
// specify NetworkID in txn
|
||||
if (txNID)
|
||||
return telNETWORK_ID_MAKES_TX_NON_CANONICAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// new networks both require the field to be present and require it to
|
||||
// match
|
||||
if (!txNID)
|
||||
return telREQUIRES_NETWORK_ID;
|
||||
uint32_t nodeNID = ctx.app.config().NETWORK_ID;
|
||||
std::optional<uint32_t> txNID = ctx.tx[~sfNetworkID];
|
||||
|
||||
if (*txNID != nodeNID)
|
||||
return telWRONG_NETWORK;
|
||||
if (nodeNID <= 1024)
|
||||
{
|
||||
// legacy networks have ids less than 1024, these networks cannot
|
||||
// specify NetworkID in txn
|
||||
if (txNID)
|
||||
return telNETWORK_ID_MAKES_TX_NON_CANONICAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// new networks both require the field to be present and require it
|
||||
// to match
|
||||
if (!txNID)
|
||||
return telREQUIRES_NETWORK_ID;
|
||||
|
||||
if (*txNID != nodeNID)
|
||||
return telWRONG_NETWORK;
|
||||
}
|
||||
}
|
||||
|
||||
auto const txID = ctx.tx.getTransactionID();
|
||||
|
||||
Reference in New Issue
Block a user