mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Compare commits
1 Commits
vlntb/tran
...
vlntb/remo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ce692db58 |
@@ -9,7 +9,6 @@ target_compile_definitions (opts
|
|||||||
BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS
|
BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS
|
||||||
BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
|
BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
|
||||||
BOOST_CONTAINER_FWD_BAD_DEQUE
|
BOOST_CONTAINER_FWD_BAD_DEQUE
|
||||||
BOOST_ASIO_ENABLE_HANDLER_TRACKING
|
|
||||||
HAS_UNCAUGHT_EXCEPTIONS=1
|
HAS_UNCAUGHT_EXCEPTIONS=1
|
||||||
$<$<BOOL:${boost_show_deprecated}>:
|
$<$<BOOL:${boost_show_deprecated}>:
|
||||||
BOOST_ASIO_NO_DEPRECATED
|
BOOST_ASIO_NO_DEPRECATED
|
||||||
|
|||||||
@@ -157,48 +157,6 @@ private:
|
|||||||
boost::filesystem::path m_path;
|
boost::filesystem::path m_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AsioTrackingBuf : public std::streambuf
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit AsioTrackingBuf(beast::Journal j)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
int
|
|
||||||
overflow(int ch) override
|
|
||||||
{
|
|
||||||
if (ch == '\n')
|
|
||||||
{
|
|
||||||
flush();
|
|
||||||
}
|
|
||||||
else if (ch != EOF)
|
|
||||||
{
|
|
||||||
buffer_ += static_cast<char>(ch);
|
|
||||||
}
|
|
||||||
return ch;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
sync() override
|
|
||||||
{
|
|
||||||
flush();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void
|
|
||||||
flush()
|
|
||||||
{
|
|
||||||
if (!buffer_.empty())
|
|
||||||
{
|
|
||||||
buffer_.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string buffer_;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::mutex mutable mutex_;
|
std::mutex mutable mutex_;
|
||||||
std::map<
|
std::map<
|
||||||
std::string,
|
std::string,
|
||||||
@@ -208,8 +166,6 @@ private:
|
|||||||
beast::severities::Severity thresh_;
|
beast::severities::Severity thresh_;
|
||||||
File file_;
|
File file_;
|
||||||
bool silent_ = false;
|
bool silent_ = false;
|
||||||
std::unique_ptr<AsioTrackingBuf> asioBuf_;
|
|
||||||
std::unique_ptr<std::ostream> asioStream_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Logs(beast::severities::Severity level);
|
Logs(beast::severities::Severity level);
|
||||||
|
|||||||
@@ -134,9 +134,6 @@ Logs::File::writeln(char const* text)
|
|||||||
Logs::Logs(beast::severities::Severity thresh)
|
Logs::Logs(beast::severities::Severity thresh)
|
||||||
: thresh_(thresh) // default severity
|
: thresh_(thresh) // default severity
|
||||||
{
|
{
|
||||||
asioBuf_ = std::make_unique<AsioTrackingBuf>(journal("AsioTracking"));
|
|
||||||
asioStream_ = std::make_unique<std::ostream>(asioBuf_.get());
|
|
||||||
std::clog.rdbuf(asioStream_->rdbuf());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -580,21 +580,8 @@ PeerImp::close()
|
|||||||
{
|
{
|
||||||
detaching_ = true; // DEPRECATED
|
detaching_ = true; // DEPRECATED
|
||||||
error_code ec;
|
error_code ec;
|
||||||
|
|
||||||
timer_.cancel(ec);
|
timer_.cancel(ec);
|
||||||
if (ec)
|
|
||||||
{
|
|
||||||
JLOG(journal_.info())
|
|
||||||
<< "PeerImp::close timer_.cancel ec: " << ec.message();
|
|
||||||
}
|
|
||||||
|
|
||||||
socket_.close(ec);
|
socket_.close(ec);
|
||||||
if (ec)
|
|
||||||
{
|
|
||||||
JLOG(journal_.info())
|
|
||||||
<< "PeerImp::close socket_.close ec: " << ec.message();
|
|
||||||
}
|
|
||||||
|
|
||||||
overlay_.incPeerDisconnect();
|
overlay_.incPeerDisconnect();
|
||||||
if (inbound_)
|
if (inbound_)
|
||||||
{
|
{
|
||||||
@@ -685,10 +672,6 @@ PeerImp::cancelTimer()
|
|||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
timer_.cancel(ec);
|
timer_.cancel(ec);
|
||||||
if (ec)
|
|
||||||
{
|
|
||||||
JLOG(journal_.info()) << "PeerImp::cancelTimer ec: " << ec.message();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -43,19 +43,10 @@ public:
|
|||||||
updateHash();
|
updateHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAMapAccountStateLeafNode(
|
|
||||||
boost::intrusive_ptr<SHAMapItem const> item,
|
|
||||||
std::uint32_t cowid,
|
|
||||||
SHAMapHash const& hash)
|
|
||||||
: SHAMapLeafNode(std::move(item), cowid, hash)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
intr_ptr::SharedPtr<SHAMapTreeNode>
|
intr_ptr::SharedPtr<SHAMapTreeNode>
|
||||||
clone(std::uint32_t cowid) const final override
|
clone(std::uint32_t cowid) const final override
|
||||||
{
|
{
|
||||||
return intr_ptr::make_shared<SHAMapAccountStateLeafNode>(
|
return intr_ptr::make_shared<SHAMapAccountStateLeafNode>(item_, cowid);
|
||||||
item_, cowid, hash_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAMapNodeType
|
SHAMapNodeType
|
||||||
@@ -67,8 +58,11 @@ public:
|
|||||||
void
|
void
|
||||||
updateHash() final override
|
updateHash() final override
|
||||||
{
|
{
|
||||||
hash_ = SHAMapHash{
|
// hash_ = SHAMapHash{
|
||||||
sha512Half(HashPrefix::leafNode, item_->slice(), item_->key())};
|
// sha512Half(HashPrefix::leafNode, item_->slice(), item_->key())};
|
||||||
|
|
||||||
|
// TODO return SHAMapHash{
|
||||||
|
// sha512Half(HashPrefix::leafNode, item_->slice(), item_->key())};
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -36,11 +36,6 @@ protected:
|
|||||||
boost::intrusive_ptr<SHAMapItem const> item,
|
boost::intrusive_ptr<SHAMapItem const> item,
|
||||||
std::uint32_t cowid);
|
std::uint32_t cowid);
|
||||||
|
|
||||||
SHAMapLeafNode(
|
|
||||||
boost::intrusive_ptr<SHAMapItem const> item,
|
|
||||||
std::uint32_t cowid,
|
|
||||||
SHAMapHash const& hash);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SHAMapLeafNode(const SHAMapLeafNode&) = delete;
|
SHAMapLeafNode(const SHAMapLeafNode&) = delete;
|
||||||
SHAMapLeafNode&
|
SHAMapLeafNode&
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ enum class SHAMapNodeType {
|
|||||||
class SHAMapTreeNode : public IntrusiveRefCounts
|
class SHAMapTreeNode : public IntrusiveRefCounts
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
SHAMapHash hash_;
|
|
||||||
|
|
||||||
/** Determines the owning SHAMap, if any. Used for copy-on-write semantics.
|
/** Determines the owning SHAMap, if any. Used for copy-on-write semantics.
|
||||||
|
|
||||||
If this value is 0, the node is not dirty and does not need to be
|
If this value is 0, the node is not dirty and does not need to be
|
||||||
@@ -75,13 +73,6 @@ protected:
|
|||||||
explicit SHAMapTreeNode(std::uint32_t cowid) noexcept : cowid_(cowid)
|
explicit SHAMapTreeNode(std::uint32_t cowid) noexcept : cowid_(cowid)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit SHAMapTreeNode(
|
|
||||||
std::uint32_t cowid,
|
|
||||||
SHAMapHash const& hash) noexcept
|
|
||||||
: hash_(hash), cowid_(cowid)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -144,7 +135,9 @@ public:
|
|||||||
SHAMapHash const&
|
SHAMapHash const&
|
||||||
getHash() const
|
getHash() const
|
||||||
{
|
{
|
||||||
return hash_;
|
// TODO
|
||||||
|
static SHAMapHash s;
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Determines the type of node. */
|
/** Determines the type of node. */
|
||||||
|
|||||||
@@ -42,18 +42,10 @@ public:
|
|||||||
updateHash();
|
updateHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAMapTxLeafNode(
|
|
||||||
boost::intrusive_ptr<SHAMapItem const> item,
|
|
||||||
std::uint32_t cowid,
|
|
||||||
SHAMapHash const& hash)
|
|
||||||
: SHAMapLeafNode(std::move(item), cowid, hash)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
intr_ptr::SharedPtr<SHAMapTreeNode>
|
intr_ptr::SharedPtr<SHAMapTreeNode>
|
||||||
clone(std::uint32_t cowid) const final override
|
clone(std::uint32_t cowid) const final override
|
||||||
{
|
{
|
||||||
return intr_ptr::make_shared<SHAMapTxLeafNode>(item_, cowid, hash_);
|
return intr_ptr::make_shared<SHAMapTxLeafNode>(item_, cowid);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAMapNodeType
|
SHAMapNodeType
|
||||||
@@ -65,8 +57,8 @@ public:
|
|||||||
void
|
void
|
||||||
updateHash() final override
|
updateHash() final override
|
||||||
{
|
{
|
||||||
hash_ =
|
// hash_ =
|
||||||
SHAMapHash{sha512Half(HashPrefix::transactionID, item_->slice())};
|
// SHAMapHash{sha512Half(HashPrefix::transactionID, item_->slice())};
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -43,19 +43,10 @@ public:
|
|||||||
updateHash();
|
updateHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAMapTxPlusMetaLeafNode(
|
|
||||||
boost::intrusive_ptr<SHAMapItem const> item,
|
|
||||||
std::uint32_t cowid,
|
|
||||||
SHAMapHash const& hash)
|
|
||||||
: SHAMapLeafNode(std::move(item), cowid, hash)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
intr_ptr::SharedPtr<SHAMapTreeNode>
|
intr_ptr::SharedPtr<SHAMapTreeNode>
|
||||||
clone(std::uint32_t cowid) const override
|
clone(std::uint32_t cowid) const override
|
||||||
{
|
{
|
||||||
return intr_ptr::make_shared<SHAMapTxPlusMetaLeafNode>(
|
return intr_ptr::make_shared<SHAMapTxPlusMetaLeafNode>(item_, cowid);
|
||||||
item_, cowid, hash_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAMapNodeType
|
SHAMapNodeType
|
||||||
@@ -67,8 +58,8 @@ public:
|
|||||||
void
|
void
|
||||||
updateHash() final override
|
updateHash() final override
|
||||||
{
|
{
|
||||||
hash_ = SHAMapHash{
|
// hash_ = SHAMapHash{
|
||||||
sha512Half(HashPrefix::txNode, item_->slice(), item_->key())};
|
// sha512Half(HashPrefix::txNode, item_->slice(), item_->key())};
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ SHAMapInnerNode::clone(std::uint32_t cowid) const
|
|||||||
auto const branchCount = getBranchCount();
|
auto const branchCount = getBranchCount();
|
||||||
auto const thisIsSparse = !hashesAndChildren_.isDense();
|
auto const thisIsSparse = !hashesAndChildren_.isDense();
|
||||||
auto p = intr_ptr::make_shared<SHAMapInnerNode>(cowid, branchCount);
|
auto p = intr_ptr::make_shared<SHAMapInnerNode>(cowid, branchCount);
|
||||||
p->hash_ = hash_;
|
|
||||||
p->isBranch_ = isBranch_;
|
p->isBranch_ = isBranch_;
|
||||||
p->fullBelowGen_ = fullBelowGen_;
|
p->fullBelowGen_ = fullBelowGen_;
|
||||||
SHAMapHash *cloneHashes, *thisHashes;
|
SHAMapHash *cloneHashes, *thisHashes;
|
||||||
@@ -154,10 +153,11 @@ SHAMapInnerNode::makeFullInner(
|
|||||||
|
|
||||||
ret->resizeChildArrays(ret->getBranchCount());
|
ret->resizeChildArrays(ret->getBranchCount());
|
||||||
|
|
||||||
if (hashValid)
|
// TODO: do this outside?
|
||||||
ret->hash_ = hash;
|
// if (hashValid)
|
||||||
else
|
// ret->hash_ = hash;
|
||||||
ret->updateHash();
|
// else
|
||||||
|
// ret->updateHash();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,9 @@ SHAMapInnerNode::updateHash()
|
|||||||
iterChildren([&](SHAMapHash const& hh) { hash_append(h, hh); });
|
iterChildren([&](SHAMapHash const& hh) { hash_append(h, hh); });
|
||||||
nh = static_cast<typename sha512_half_hasher::result_type>(h);
|
nh = static_cast<typename sha512_half_hasher::result_type>(h);
|
||||||
}
|
}
|
||||||
hash_ = SHAMapHash{nh};
|
|
||||||
|
// TODO return SHAMapHash{nh};
|
||||||
|
// hash_ = SHAMapHash{nh};
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -314,8 +316,6 @@ SHAMapInnerNode::setChild(int m, intr_ptr::SharedPtr<SHAMapTreeNode> child)
|
|||||||
children[childIndex] = std::move(child);
|
children[childIndex] = std::move(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
hash_.zero();
|
|
||||||
|
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT(
|
||||||
getBranchCount() <= hashesAndChildren_.capacity(),
|
getBranchCount() <= hashesAndChildren_.capacity(),
|
||||||
"ripple::SHAMapInnerNode::setChild : maximum branch count");
|
"ripple::SHAMapInnerNode::setChild : maximum branch count");
|
||||||
@@ -472,15 +472,9 @@ SHAMapInnerNode::invariants(bool is_root) const
|
|||||||
|
|
||||||
if (!is_root)
|
if (!is_root)
|
||||||
{
|
{
|
||||||
XRPL_ASSERT(
|
|
||||||
hash_.isNonZero(),
|
|
||||||
"ripple::SHAMapInnerNode::invariants : nonzero hash");
|
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT(
|
||||||
count >= 1, "ripple::SHAMapInnerNode::invariants : minimum count");
|
count >= 1, "ripple::SHAMapInnerNode::invariants : minimum count");
|
||||||
}
|
}
|
||||||
XRPL_ASSERT(
|
|
||||||
(count == 0) ? hash_.isZero() : hash_.isNonZero(),
|
|
||||||
"ripple::SHAMapInnerNode::invariants : hash and count do match");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|||||||
@@ -32,19 +32,6 @@ SHAMapLeafNode::SHAMapLeafNode(
|
|||||||
"SHAMapItem const>, std::uint32_t) : minimum input size");
|
"SHAMapItem const>, std::uint32_t) : minimum input size");
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAMapLeafNode::SHAMapLeafNode(
|
|
||||||
boost::intrusive_ptr<SHAMapItem const> item,
|
|
||||||
std::uint32_t cowid,
|
|
||||||
SHAMapHash const& hash)
|
|
||||||
: SHAMapTreeNode(cowid, hash), item_(std::move(item))
|
|
||||||
{
|
|
||||||
XRPL_ASSERT(
|
|
||||||
item_->size() >= 12,
|
|
||||||
"ripple::SHAMapLeafNode::SHAMapLeafNode(boost::intrusive_ptr<"
|
|
||||||
"SHAMapItem const>, std::uint32_t, SHAMapHash const&) : minimum input "
|
|
||||||
"size");
|
|
||||||
}
|
|
||||||
|
|
||||||
boost::intrusive_ptr<SHAMapItem const> const&
|
boost::intrusive_ptr<SHAMapItem const> const&
|
||||||
SHAMapLeafNode::peekItem() const
|
SHAMapLeafNode::peekItem() const
|
||||||
{
|
{
|
||||||
@@ -57,11 +44,14 @@ SHAMapLeafNode::setItem(boost::intrusive_ptr<SHAMapItem const> item)
|
|||||||
XRPL_ASSERT(cowid_, "ripple::SHAMapLeafNode::setItem : nonzero cowid");
|
XRPL_ASSERT(cowid_, "ripple::SHAMapLeafNode::setItem : nonzero cowid");
|
||||||
item_ = std::move(item);
|
item_ = std::move(item);
|
||||||
|
|
||||||
auto const oldHash = hash_;
|
// auto const oldHash = hash_;
|
||||||
|
|
||||||
updateHash();
|
// updateHash();
|
||||||
|
|
||||||
return (oldHash != hash_);
|
// return (oldHash != hash_);
|
||||||
|
|
||||||
|
// TODO : return updateHash();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
@@ -82,8 +72,8 @@ SHAMapLeafNode::getString(const SHAMapNodeID& id) const
|
|||||||
|
|
||||||
ret += " Tag=";
|
ret += " Tag=";
|
||||||
ret += to_string(item_->key());
|
ret += to_string(item_->key());
|
||||||
ret += "\n Hash=";
|
// ret += "\n Hash=";
|
||||||
ret += to_string(hash_);
|
// ret += to_string(hash_);
|
||||||
ret += "/";
|
ret += "/";
|
||||||
ret += std::to_string(item_->size());
|
ret += std::to_string(item_->size());
|
||||||
return ret;
|
return ret;
|
||||||
@@ -92,8 +82,6 @@ SHAMapLeafNode::getString(const SHAMapNodeID& id) const
|
|||||||
void
|
void
|
||||||
SHAMapLeafNode::invariants(bool) const
|
SHAMapLeafNode::invariants(bool) const
|
||||||
{
|
{
|
||||||
XRPL_ASSERT(
|
|
||||||
hash_.isNonZero(), "ripple::SHAMapLeafNode::invariants : nonzero hash");
|
|
||||||
XRPL_ASSERT(item_, "ripple::SHAMapLeafNode::invariants : non-null item");
|
XRPL_ASSERT(item_, "ripple::SHAMapLeafNode::invariants : non-null item");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ SHAMapTreeNode::makeTransaction(
|
|||||||
make_shamapitem(sha512Half(HashPrefix::transactionID, data), data);
|
make_shamapitem(sha512Half(HashPrefix::transactionID, data), data);
|
||||||
|
|
||||||
if (hashValid)
|
if (hashValid)
|
||||||
return intr_ptr::make_shared<SHAMapTxLeafNode>(
|
return intr_ptr::make_shared<SHAMapTxLeafNode>(std::move(item), 0);
|
||||||
std::move(item), 0, hash);
|
|
||||||
|
|
||||||
return intr_ptr::make_shared<SHAMapTxLeafNode>(std::move(item), 0);
|
return intr_ptr::make_shared<SHAMapTxLeafNode>(std::move(item), 0);
|
||||||
}
|
}
|
||||||
@@ -72,7 +71,7 @@ SHAMapTreeNode::makeTransactionWithMeta(
|
|||||||
|
|
||||||
if (hashValid)
|
if (hashValid)
|
||||||
return intr_ptr::make_shared<SHAMapTxPlusMetaLeafNode>(
|
return intr_ptr::make_shared<SHAMapTxPlusMetaLeafNode>(
|
||||||
std::move(item), 0, hash);
|
std::move(item), 0);
|
||||||
|
|
||||||
return intr_ptr::make_shared<SHAMapTxPlusMetaLeafNode>(std::move(item), 0);
|
return intr_ptr::make_shared<SHAMapTxPlusMetaLeafNode>(std::move(item), 0);
|
||||||
}
|
}
|
||||||
@@ -104,7 +103,7 @@ SHAMapTreeNode::makeAccountState(
|
|||||||
|
|
||||||
if (hashValid)
|
if (hashValid)
|
||||||
return intr_ptr::make_shared<SHAMapAccountStateLeafNode>(
|
return intr_ptr::make_shared<SHAMapAccountStateLeafNode>(
|
||||||
std::move(item), 0, hash);
|
std::move(item), 0);
|
||||||
|
|
||||||
return intr_ptr::make_shared<SHAMapAccountStateLeafNode>(
|
return intr_ptr::make_shared<SHAMapAccountStateLeafNode>(
|
||||||
std::move(item), 0);
|
std::move(item), 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user