diff --git a/src/ripple/protocol/impl/TER.cpp b/src/ripple/protocol/impl/TER.cpp index b7bc39186..9fee2d927 100644 --- a/src/ripple/protocol/impl/TER.cpp +++ b/src/ripple/protocol/impl/TER.cpp @@ -136,7 +136,6 @@ transResults() MAKE_ERROR(telNON_LOCAL_EMITTED_TXN, "Emitted transaction cannot be applied because it was not generated locally."), MAKE_ERROR(telIMPORT_VL_KEY_NOT_RECOGNISED, "Import vl key was not recognized."), MAKE_ERROR(telCAN_NOT_QUEUE_IMPORT, "Import transaction was not able to be directly applied and cannot be queued."), - MAKE_ERROR(temMALFORMED, "Malformed transaction."), MAKE_ERROR(temBAD_AMOUNT, "Can only send positive amounts."), MAKE_ERROR(temBAD_CURRENCY, "Malformed: Bad currency."), diff --git a/src/test/app/NetworkID_test.cpp b/src/test/app/NetworkID_test.cpp index c5488b331..e650667f8 100644 --- a/src/test/app/NetworkID_test.cpp +++ b/src/test/app/NetworkID_test.cpp @@ -48,7 +48,9 @@ public: void testNetworkID() { - testcase("network_id"); + testcase( + "Require txn NetworkID to be specified (or not) depending on the " + "network ID of the node"); using namespace jtx; auto const alice = Account{"alice"}; @@ -66,9 +68,14 @@ public: jv[jss::Destination] = alice.human(); jv[jss::TransactionType] = "Payment"; jv[jss::Amount] = "10000000000"; + if (env.app().config().NETWORK_ID > 1024) + jv[jss::NetworkID] = + std::to_string(env.app().config().NETWORK_ID); + env(jv, fee(1000), sig(env.master)); } + // run tx env(jv, fee(1000), ter(expectedOutcome)); env.close(); }; @@ -121,29 +128,11 @@ public: test::jtx::Env env{*this, makeNetworkConfig(1025)}; BEAST_EXPECT(env.app().config().NETWORK_ID == 1025); - { - env.fund(XRP(200), alice); - // try to submit a txn without network id, this should not work - Json::Value jvn; - jvn[jss::Account] = alice.human(); - jvn[jss::TransactionType] = jss::AccountSet; - jvn[jss::Fee] = to_string(env.current()->fees().base); - jvn[jss::Sequence] = env.seq(alice); - jvn[jss::LastLedgerSequence] = env.current()->info().seq + 2; - auto jt = env.jtnofill(jvn, alice); - Serializer s; - jt.stx->add(s); - BEAST_EXPECT( - env.rpc( - "submit", - strHex(s.slice()))[jss::result][jss::engine_result] == - "telREQUIRES_NETWORK_ID"); - env.close(); - } - + // try to submit a txn without network id, this should not work Json::Value jv; jv[jss::Account] = alice.human(); jv[jss::TransactionType] = jss::AccountSet; + runTx(env, jv, telREQUIRES_NETWORK_ID); // try to submit with wrong network id jv[jss::NetworkID] = 0;