diff --git a/src/ripple/app/ledger/MetaView.h b/src/ripple/app/ledger/MetaView.h index 81b452d5a8..544fb1bcac 100644 --- a/src/ripple/app/ledger/MetaView.h +++ b/src/ripple/app/ledger/MetaView.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -97,6 +98,7 @@ private: item_list items_; std::uint32_t destroyedCoins_ = 0; boost::optional deliverAmount_; + std::shared_ptr hold_; public: MetaView() = delete; @@ -112,7 +114,7 @@ public: The SLEs and Serializers in the copy are shared with the other view. The copy has the same Info values. - + It is only safe to use the BasicView modification functions. Using View modification functions will break invariants. @@ -137,6 +139,10 @@ public: The parentCloseTime is set to the closeTime of parent. + If `hold` is not nullptr, retains + ownership of a copy of `hold` until + the MetaView is destroyed. + It is only safe to use the BasicView modification functions. Using View modification functions will break invariants. @@ -145,7 +151,9 @@ public: ledger that this open ledger follows. */ MetaView (open_ledger_t, - BasicView const& parent); + BasicView const& parent, + std::shared_ptr< + void const> hold = nullptr); /** Create a nested MetaView. @@ -154,7 +162,8 @@ public: The ViewInfo is copied from the base. */ MetaView (BasicView const& base, - ViewFlags flags); + ViewFlags flags, std::shared_ptr< + void const> hold = nullptr); //-------------------------------------------------------------------------- // diff --git a/src/ripple/app/ledger/impl/MetaView.cpp b/src/ripple/app/ledger/impl/MetaView.cpp index 63be9b0076..e2e98c9731 100644 --- a/src/ripple/app/ledger/impl/MetaView.cpp +++ b/src/ripple/app/ledger/impl/MetaView.cpp @@ -55,14 +55,18 @@ MetaView::MetaView (shallow_copy_t, , items_ (other.items_) , destroyedCoins_( other.destroyedCoins_) + , hold_(other.hold_) { } MetaView::MetaView (open_ledger_t, - BasicView const& parent) + BasicView const& parent, + std::shared_ptr< + void const> hold) : base_ (parent) , flags_ (tapNONE) , info_ (parent.info()) + , hold_(std::move(hold)) { assert(! parent.open()); info_.open = true; @@ -72,10 +76,12 @@ MetaView::MetaView (open_ledger_t, } MetaView::MetaView (BasicView const& base, - ViewFlags flags) + ViewFlags flags, std::shared_ptr< + void const> hold) : base_ (base) , flags_ (flags) , info_ (base.info()) + , hold_(std::move(hold)) { }