mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-28 07:35:52 +00:00
checkpoint
This commit is contained in:
@@ -1,21 +1,5 @@
|
|||||||
#include <handlers/RPCHelpers.h>
|
#include <handlers/RPCHelpers.h>
|
||||||
#include <reporting/BackendInterface.h>
|
#include <reporting/BackendInterface.h>
|
||||||
std::vector<unsigned char>
|
|
||||||
ledgerInfoToBlob(ripple::LedgerInfo const& info)
|
|
||||||
{
|
|
||||||
ripple::Serializer s;
|
|
||||||
s.add32(info.seq);
|
|
||||||
s.add64(info.drops.drops());
|
|
||||||
s.addBitString(info.parentHash);
|
|
||||||
s.addBitString(info.txHash);
|
|
||||||
s.addBitString(info.accountHash);
|
|
||||||
s.add32(info.parentCloseTime.time_since_epoch().count());
|
|
||||||
s.add32(info.closeTime.time_since_epoch().count());
|
|
||||||
s.add8(info.closeTimeResolution.count());
|
|
||||||
s.add8(info.closeFlags);
|
|
||||||
// s.addBitString(info.hash);
|
|
||||||
return s.peekData();
|
|
||||||
}
|
|
||||||
|
|
||||||
boost::json::object
|
boost::json::object
|
||||||
doLedger(boost::json::object const& request, BackendInterface const& backend)
|
doLedger(boost::json::object const& request, BackendInterface const& backend)
|
||||||
|
|||||||
@@ -80,3 +80,19 @@ ledgerSequenceFromRequest(
|
|||||||
return request.at("ledger_index").as_int64();
|
return request.at("ledger_index").as_int64();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::vector<unsigned char>
|
||||||
|
ledgerInfoToBlob(ripple::LedgerInfo const& info)
|
||||||
|
{
|
||||||
|
ripple::Serializer s;
|
||||||
|
s.add32(info.seq);
|
||||||
|
s.add64(info.drops.drops());
|
||||||
|
s.addBitString(info.parentHash);
|
||||||
|
s.addBitString(info.txHash);
|
||||||
|
s.addBitString(info.accountHash);
|
||||||
|
s.add32(info.parentCloseTime.time_since_epoch().count());
|
||||||
|
s.add32(info.closeTime.time_since_epoch().count());
|
||||||
|
s.add8(info.closeTimeResolution.count());
|
||||||
|
s.add8(info.closeFlags);
|
||||||
|
s.addBitString(info.hash);
|
||||||
|
return s.peekData();
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,5 +24,7 @@ std::optional<uint32_t>
|
|||||||
ledgerSequenceFromRequest(
|
ledgerSequenceFromRequest(
|
||||||
boost::json::object const& request,
|
boost::json::object const& request,
|
||||||
BackendInterface const& backend);
|
BackendInterface const& backend);
|
||||||
|
std::vector<unsigned char>
|
||||||
|
ledgerInfoToBlob(ripple::LedgerInfo const& info);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ BackendIndexer::~BackendIndexer()
|
|||||||
std::unique_lock lck(mutex_);
|
std::unique_lock lck(mutex_);
|
||||||
work_.reset();
|
work_.reset();
|
||||||
ioThread_.join();
|
ioThread_.join();
|
||||||
|
updateThread_.join();
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
BackendIndexer::writeLedgerObject(
|
BackendIndexer::writeLedgerObject(
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
static void
|
static void
|
||||||
noticeReceiver(void* arg, PGresult const* res)
|
noticeReceiver(void* arg, PGresult const* res)
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(debug) << "server message: " << PQresultErrorMessage(res);
|
BOOST_LOG_TRIVIAL(trace) << "server message: " << PQresultErrorMessage(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -846,7 +846,11 @@ PostgresBackend::writeKeys(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isAsync)
|
if (isAsync)
|
||||||
|
{
|
||||||
|
if (numRows > 0)
|
||||||
|
conn.bulkInsert("keys", buffer.str());
|
||||||
conn("COMMIT");
|
conn("COMMIT");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool
|
bool
|
||||||
@@ -890,7 +894,11 @@ PostgresBackend::writeBooks(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isAsync)
|
if (isAsync)
|
||||||
|
{
|
||||||
|
if (numRows > 0)
|
||||||
|
conn.bulkInsert("books", buffer.str());
|
||||||
conn("COMMIT");
|
conn("COMMIT");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool
|
bool
|
||||||
|
|||||||
2
test.py
2
test.py
@@ -729,7 +729,7 @@ async def ledger(ip, port, ledger, binary, transactions, expand):
|
|||||||
async with websockets.connect(address,max_size=1000000000) as ws:
|
async with websockets.connect(address,max_size=1000000000) as ws:
|
||||||
await ws.send(json.dumps({"command":"ledger","ledger_index":int(ledger),"binary":bool(binary), "transactions":bool(transactions),"expand":bool(expand)}))
|
await ws.send(json.dumps({"command":"ledger","ledger_index":int(ledger),"binary":bool(binary), "transactions":bool(transactions),"expand":bool(expand)}))
|
||||||
res = json.loads(await ws.recv())
|
res = json.loads(await ws.recv())
|
||||||
#print(json.dumps(res,indent=4,sort_keys=True))
|
print(json.dumps(res,indent=4,sort_keys=True))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
except websockets.exceptions.connectionclosederror as e:
|
except websockets.exceptions.connectionclosederror as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user