diff --git a/src/ripple/rpc/handlers/AccountChannels.cpp b/src/ripple/rpc/handlers/AccountChannels.cpp index 8f39bef16..229222b6a 100644 --- a/src/ripple/rpc/handlers/AccountChannels.cpp +++ b/src/ripple/rpc/handlers/AccountChannels.cpp @@ -38,7 +38,7 @@ addChannel(Json::Value& jsonLines, SLE const& line) jDst[jss::channel_id] = to_string(line.key()); jDst[jss::account] = to_string(line[sfAccount]); jDst[jss::destination_account] = to_string(line[sfDestination]); - jDst[jss::amount] = line[sfAmount].getText(); + line[sfAmount].setJson(jDst[jss::amount]); jDst[jss::balance] = line[sfBalance].getText(); if (publicKeyType(line[sfPublicKey])) { @@ -170,6 +170,10 @@ doAccountChannels(RPC::JsonContext& context) return false; } + // Filter out ripple state objects. + if (sleCur->getType() != ltPAYCHAN) + return false; + if (++count == limit) { marker = sleCur->key(); diff --git a/src/test/app/NetworkID_test.cpp b/src/test/app/NetworkID_test.cpp index e650667f8..51c4595da 100644 --- a/src/test/app/NetworkID_test.cpp +++ b/src/test/app/NetworkID_test.cpp @@ -129,10 +129,28 @@ public: BEAST_EXPECT(env.app().config().NETWORK_ID == 1025); // try to submit a txn without network id, this should not work + { + env.fund(XRP(200), alice); + 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(); + } + 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;