Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_feefilter.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2016-2019 The Bitcoin Core developers | # Copyright (c) 2016-2019 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Test processing of feefilter messages.""" | """Test processing of feefilter messages.""" | ||||
from decimal import Decimal | from decimal import Decimal | ||||
import time | import time | ||||
from test_framework.messages import msg_feefilter | from test_framework.messages import MSG_TX, msg_feefilter | ||||
from test_framework.mininode import ( | from test_framework.mininode import ( | ||||
mininode_lock, | mininode_lock, | ||||
P2PInterface, | P2PInterface, | ||||
) | ) | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
def hashToHex(hash): | def hashToHex(hash): | ||||
Show All 13 Lines | |||||
class TestP2PConn(P2PInterface): | class TestP2PConn(P2PInterface): | ||||
def __init__(self): | def __init__(self): | ||||
super().__init__() | super().__init__() | ||||
self.txinvs = [] | self.txinvs = [] | ||||
def on_inv(self, message): | def on_inv(self, message): | ||||
for i in message.inv: | for i in message.inv: | ||||
if (i.type == 1): | if (i.type == MSG_TX): | ||||
self.txinvs.append(hashToHex(i.hash)) | self.txinvs.append(hashToHex(i.hash)) | ||||
def clear_invs(self): | def clear_invs(self): | ||||
with mininode_lock: | with mininode_lock: | ||||
self.txinvs = [] | self.txinvs = [] | ||||
class FeeFilterTest(BitcoinTestFramework): | class FeeFilterTest(BitcoinTestFramework): | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |