Skip to content

Commit 15a4ec9

Browse files
committed
[prep/rpc] remove entry and expiry time from getorphantxs
Expiry is going away in a later commit. This is only an RPC change. Behavior of the orphanage does not change. Note that getorphantxs is marked experimental.
1 parent 08e58fa commit 15a4ec9

File tree

5 files changed

+3
-17
lines changed

5 files changed

+3
-17
lines changed

src/node/txorphanage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
3737
return false;
3838
}
3939

40-
auto ret = m_orphans.emplace(wtxid, OrphanTx{{tx, {peer}, Now<NodeSeconds>() + ORPHAN_TX_EXPIRE_TIME}, m_orphan_list.size()});
40+
auto ret = m_orphans.emplace(wtxid, OrphanTx{{tx, {peer}}, Now<NodeSeconds>() + ORPHAN_TX_EXPIRE_TIME, m_orphan_list.size()});
4141
assert(ret.second);
4242
m_orphan_list.push_back(ret.first);
4343
for (const CTxIn& txin : tx->vin) {
@@ -318,7 +318,7 @@ std::vector<TxOrphanage::OrphanTxBase> TxOrphanage::GetOrphanTransactions() cons
318318
std::vector<OrphanTxBase> ret;
319319
ret.reserve(m_orphans.size());
320320
for (auto const& o : m_orphans) {
321-
ret.push_back({o.second.tx, o.second.announcers, o.second.nTimeExpire});
321+
ret.push_back({o.second.tx, o.second.announcers});
322322
}
323323
return ret;
324324
}

src/node/txorphanage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ class TxOrphanage {
8484
CTransactionRef tx;
8585
/** Peers added with AddTx or AddAnnouncer. */
8686
std::set<NodeId> announcers;
87-
NodeSeconds nTimeExpire;
8887

8988
/** Get the weight of this transaction, an approximation of its memory usage. */
9089
unsigned int GetUsage() const {
@@ -112,6 +111,7 @@ class TxOrphanage {
112111

113112
protected:
114113
struct OrphanTx : public OrphanTxBase {
114+
NodeSeconds nTimeExpire;
115115
size_t list_pos;
116116
};
117117

src/rpc/mempool.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,6 @@ static std::vector<RPCResult> OrphanDescription()
832832
RPCResult{RPCResult::Type::NUM, "bytes", "The serialized transaction size in bytes"},
833833
RPCResult{RPCResult::Type::NUM, "vsize", "The virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted."},
834834
RPCResult{RPCResult::Type::NUM, "weight", "The transaction weight as defined in BIP 141."},
835-
RPCResult{RPCResult::Type::NUM_TIME, "entry", "The entry time into the orphanage expressed in " + UNIX_EPOCH_TIME},
836-
RPCResult{RPCResult::Type::NUM_TIME, "expiration", "The orphan expiration time expressed in " + UNIX_EPOCH_TIME},
837835
RPCResult{RPCResult::Type::ARR, "from", "",
838836
{
839837
RPCResult{RPCResult::Type::NUM, "peer_id", "Peer ID"},
@@ -849,8 +847,6 @@ static UniValue OrphanToJSON(const node::TxOrphanage::OrphanTxBase& orphan)
849847
o.pushKV("bytes", orphan.tx->GetTotalSize());
850848
o.pushKV("vsize", GetVirtualTransactionSize(*orphan.tx));
851849
o.pushKV("weight", GetTransactionWeight(*orphan.tx));
852-
o.pushKV("entry", int64_t{TicksSinceEpoch<std::chrono::seconds>(orphan.nTimeExpire - node::ORPHAN_TX_EXPIRE_TIME)});
853-
o.pushKV("expiration", int64_t{TicksSinceEpoch<std::chrono::seconds>(orphan.nTimeExpire)});
854850
UniValue from(UniValue::VARR);
855851
for (const auto fromPeer: orphan.announcers) {
856852
from.push_back(fromPeer);

test/functional/rpc_orphans.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Tests for orphan related RPCs."""
66

7-
import time
8-
97
from test_framework.mempool_util import (
10-
ORPHAN_TX_EXPIRE_TIME,
118
tx_in_orphanage,
129
)
1310
from test_framework.messages import (
@@ -101,8 +98,6 @@ def test_orphan_details(self):
10198
tx_child_2 = self.wallet.create_self_transfer(utxo_to_spend=tx_parent_2["new_utxo"])
10299
peer_1 = node.add_p2p_connection(P2PInterface())
103100
peer_2 = node.add_p2p_connection(P2PInterface())
104-
entry_time = int(time.time())
105-
node.setmocktime(entry_time)
106101
peer_1.send_and_ping(msg_tx(tx_child_1["tx"]))
107102
peer_2.send_and_ping(msg_tx(tx_child_2["tx"]))
108103

@@ -128,9 +123,6 @@ def test_orphan_details(self):
128123
assert_equal(len(node.getorphantxs()), 1)
129124
orphan_1 = orphanage[0]
130125
self.orphan_details_match(orphan_1, tx_child_1, verbosity=1)
131-
self.log.info("Checking orphan entry/expiration times")
132-
assert_equal(orphan_1["entry"], entry_time)
133-
assert_equal(orphan_1["expiration"], entry_time + ORPHAN_TX_EXPIRE_TIME)
134126

135127
self.log.info("Checking orphan details (verbosity 2)")
136128
orphanage = node.getorphantxs(verbosity=2)

test/functional/test_framework/mempool_util.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
MiniWallet,
2020
)
2121

22-
ORPHAN_TX_EXPIRE_TIME = 1200
23-
2422
def assert_mempool_contents(test_framework, node, expected=None, sync=True):
2523
"""Assert that all transactions in expected are in the mempool,
2624
and no additional ones exist. 'expected' is an array of

0 commit comments

Comments
 (0)