Json::Value WebThreeStubServer::admin_eth_vmTrace(std::string const& _blockNumberOrHash, int _txIndex, std::string const& _session)
{
	ADMIN_GUARD;

	Json::Value ret;

	auto c = m_web3.ethereum();
	State state = c->state(_txIndex + 1, blockHash(_blockNumberOrHash));

	if (_txIndex < 0)
		throw jsonrpc::JsonRpcException("Negative index");

	if ((unsigned)_txIndex < state.pending().size())
	{
		Executive e(state, bc(), 0);
		Transaction t = state.pending()[_txIndex];
		state = state.fromPending(_txIndex);
		try
		{
			StandardTrace st;
			st.setShowMnemonics();
			e.initialize(t);
			if (!e.execute())
				e.go(st.onOp());
			e.finalize();
			Json::Reader().parse(st.json(), ret);
		}
		catch(Exception const& _e)
		{
			cwarn << diagnostic_information(_e);
		}
	}

	return ret;
}
Пример #2
0
Json::Value Debug::traceTransaction(Executive& _e, Transaction const& _t, Json::Value const& _json)
{
	Json::Value trace;
	StandardTrace st;
	st.setShowMnemonics();
	st.setOptions(debugOptions(_json));
	_e.initialize(_t);
	if (!_e.execute())
		_e.go(st.onOp());
	_e.finalize();
	Json::Reader().parse(st.json(), trace);
	return trace;
}