diff --git a/src/ripple/app/tx/impl/Transactor.cpp b/src/ripple/app/tx/impl/Transactor.cpp index 449392531b8..1affb6fcc56 100644 --- a/src/ripple/app/tx/impl/Transactor.cpp +++ b/src/ripple/app/tx/impl/Transactor.cpp @@ -40,25 +40,28 @@ namespace ripple { NotTEC preflight0(PreflightContext const& ctx) { - uint32_t const nodeNID = ctx.app.config().NETWORK_ID; - std::optional 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 txNID = ctx.tx[~sfNetworkID]; + + 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; + if (*txNID != nodeNID) + return telWRONG_NETWORK; + } } auto const txID = ctx.tx.getTransactionID();