#ifndef BOSS_MOD_CHANNELFEEMANAGER_HPP #define BOSS_MOD_CHANNELFEEMANAGER_HPP #include"Ln/NodeId.hpp" #include #include #include #include namespace Ev { template class Io; } namespace S { class Bus; } namespace Boss { namespace Mod { /** class Boss::Mod::ChannelFeeManager * * @brief module that sets the channel fees, based * on the median fees of other peers of the node, * multiplied by modifiers solicited from other * modules. */ class ChannelFeeManager { private: S::Bus& bus; bool initted; bool soliciting; std::vector( Ln::NodeId , std::uint32_t // b , std::uint32_t // p ) >> modifiers; enum ZeroBaseFee { ZeroBaseFee_Require, ZeroBaseFee_Allow, ZeroBaseFee_Disallow }; ZeroBaseFee zero_base_fee; void start(); Ev::Io perform( Ln::NodeId node , std::uint32_t median_base , std::uint32_t median_proportional ); Ev::Io solicit(); struct Info { std::uint32_t median_base; std::uint32_t median_proportional; double multiplier; std::uint32_t final_base; std::uint32_t final_proportional; }; std::map infos; public: ChannelFeeManager() =delete; ChannelFeeManager(ChannelFeeManager&&) =delete; ChannelFeeManager(ChannelFeeManager const&) =delete; explicit ChannelFeeManager(S::Bus& bus_ ) : bus(bus_) , initted(false) , soliciting(false) , zero_base_fee(ZeroBaseFee_Allow) { start(); } }; }} #endif /* !defined(BOSS_MOD_CHANNELFEEMANAGER_HPP) */