mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Implement "feefilter" P2P message.
The "feefilter" p2p message is used to inform other nodes of your mempool min fee which is the feerate that any new transaction must meet to be accepted to your mempool. This will allow them to filter invs to you according to this feerate.
This commit is contained in:
20
src/net.cpp
20
src/net.cpp
@@ -2053,20 +2053,15 @@ public:
|
||||
instance_of_cnetcleanup;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void RelayTransaction(const CTransaction& tx)
|
||||
void RelayTransaction(const CTransaction& tx, CFeeRate feerate)
|
||||
{
|
||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ss.reserve(10000);
|
||||
ss << tx;
|
||||
RelayTransaction(tx, ss);
|
||||
RelayTransaction(tx, feerate, ss);
|
||||
}
|
||||
|
||||
void RelayTransaction(const CTransaction& tx, const CDataStream& ss)
|
||||
void RelayTransaction(const CTransaction& tx, CFeeRate feerate, const CDataStream& ss)
|
||||
{
|
||||
CInv inv(MSG_TX, tx.GetHash());
|
||||
{
|
||||
@@ -2087,6 +2082,11 @@ void RelayTransaction(const CTransaction& tx, const CDataStream& ss)
|
||||
{
|
||||
if(!pnode->fRelayTxes)
|
||||
continue;
|
||||
{
|
||||
LOCK(pnode->cs_feeFilter);
|
||||
if (feerate.GetFeePerK() < pnode->minFeeFilter)
|
||||
continue;
|
||||
}
|
||||
LOCK(pnode->cs_filter);
|
||||
if (pnode->pfilter)
|
||||
{
|
||||
@@ -2390,6 +2390,10 @@ CNode::CNode(SOCKET hSocketIn, const CAddress& addrIn, const std::string& addrNa
|
||||
nPingUsecTime = 0;
|
||||
fPingQueued = false;
|
||||
nMinPingUsecTime = std::numeric_limits<int64_t>::max();
|
||||
minFeeFilter = 0;
|
||||
lastSentFeeFilter = 0;
|
||||
nextSendTimeFeeFilter = 0;
|
||||
|
||||
BOOST_FOREACH(const std::string &msg, getAllNetMessageTypes())
|
||||
mapRecvBytesPerMsgCmd[msg] = 0;
|
||||
mapRecvBytesPerMsgCmd[NET_MESSAGE_COMMAND_OTHER] = 0;
|
||||
|
||||
Reference in New Issue
Block a user