mirror of
				https://github.com/Xahau/xahaud.git
				synced 2025-11-04 02:35:48 +00:00 
			
		
		
		
	Improve RPC error message for fee command:
* If rippled is not synced to the network, `fee` will return a "no network" error instead of the possibly confusing "not enabled" error. * Resolves RIPD-1588
This commit is contained in:
		
				
					committed by
					
						
						Mike Ellery
					
				
			
			
				
	
			
			
			
						parent
						
							e98c76110a
						
					
				
				
					commit
					af1697cc6a
				
			@@ -30,6 +30,7 @@ namespace ripple
 | 
			
		||||
    {
 | 
			
		||||
        // Bail if fee escalation is not enabled.
 | 
			
		||||
        auto const view = context.app.openLedger().current();
 | 
			
		||||
        BOOST_ASSERT(view);
 | 
			
		||||
        if (!view || !view->rules().enabled(featureFeeEscalation))
 | 
			
		||||
        {
 | 
			
		||||
            RPC::inject_error(rpcNOT_ENABLED, context.params);
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ Handler const handlerArray[] {
 | 
			
		||||
    {   "gateway_balances",     byRef (&doGatewayBalances),     Role::USER,  NO_CONDITION  },
 | 
			
		||||
    {   "get_counts",           byRef (&doGetCounts),           Role::ADMIN,   NO_CONDITION     },
 | 
			
		||||
    {   "feature",              byRef (&doFeature),             Role::ADMIN,   NO_CONDITION     },
 | 
			
		||||
    {   "fee",                  byRef (&doFee),                 Role::USER,    NO_CONDITION     },
 | 
			
		||||
    {   "fee",                  byRef (&doFee),                 Role::USER,    NEEDS_CURRENT_LEDGER     },
 | 
			
		||||
    {   "fetch_info",           byRef (&doFetchInfo),           Role::ADMIN,   NO_CONDITION     },
 | 
			
		||||
    {   "ledger_accept",        byRef (&doLedgerAccept),        Role::ADMIN,   NEEDS_CURRENT_LEDGER  },
 | 
			
		||||
    {   "ledger_cleaner",       byRef (&doLedgerCleaner),       Role::ADMIN,   NEEDS_NETWORK_CONNECTION  },
 | 
			
		||||
 
 | 
			
		||||
@@ -1664,7 +1664,7 @@ public:
 | 
			
		||||
            auto fee = env.rpc("fee");
 | 
			
		||||
 | 
			
		||||
            if (BEAST_EXPECT(fee.isMember(jss::result) &&
 | 
			
		||||
                !RPC::contains_error(fee[jss::result])))
 | 
			
		||||
                BEAST_EXPECT(!RPC::contains_error(fee[jss::result]))))
 | 
			
		||||
            {
 | 
			
		||||
                auto const& result = fee[jss::result];
 | 
			
		||||
                BEAST_EXPECT(result.isMember(jss::ledger_current_index)
 | 
			
		||||
@@ -1692,7 +1692,7 @@ public:
 | 
			
		||||
            fee = env.rpc("fee");
 | 
			
		||||
 | 
			
		||||
            if (BEAST_EXPECT(fee.isMember(jss::result) &&
 | 
			
		||||
                !RPC::contains_error(fee[jss::result])))
 | 
			
		||||
                BEAST_EXPECT(!RPC::contains_error(fee[jss::result]))))
 | 
			
		||||
            {
 | 
			
		||||
                auto const& result = fee[jss::result];
 | 
			
		||||
                BEAST_EXPECT(result.isMember(jss::ledger_current_index)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user