aboutsummaryrefslogtreecommitdiff
path: root/test/functional/mempool_accept.py
diff options
context:
space:
mode:
authorcodeShark149 <rajarshi149@gmail.com>2020-05-24 18:28:56 +0530
committergzhao408 <gzhao408@berkeley.edu>2020-09-15 18:01:32 -0700
commit2233a93a109b10b6fe0f5f26c2bb529c8de3dde7 (patch)
tree254b829dc0e2ed876388e4ec9f81c36c26d0cf26 /test/functional/mempool_accept.py
parent9366a73d695136fec8de12d3942254543903c0cd (diff)
downloadbitcoin-2233a93a109b10b6fe0f5f26c2bb529c8de3dde7.tar.xz
[rpc] Return fee and vsize from testmempoolaccept
Return fee and vsize if tx would pass ATMP.
Diffstat (limited to 'test/functional/mempool_accept.py')
-rwxr-xr-xtest/functional/mempool_accept.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py
index 6df8f1c3ec..ee9ca92046 100755
--- a/test/functional/mempool_accept.py
+++ b/test/functional/mempool_accept.py
@@ -4,6 +4,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mempool acceptance of raw transactions."""
+from decimal import Decimal
from io import BytesIO
import math
@@ -91,20 +92,22 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_0)))
txid_0 = tx.rehash()
self.check_mempool_result(
- result_expected=[{'txid': txid_0, 'allowed': True}],
+ result_expected=[{'txid': txid_0, 'allowed': True, 'vsize': 110, 'fees': {'base': Decimal(str(fee))}}],
rawtxs=[raw_tx_0],
)
self.log.info('A final transaction not in the mempool')
coin = coins.pop() # Pick a random coin(base) to spend
+ output_amount = 0.025
raw_tx_final = node.signrawtransactionwithwallet(node.createrawtransaction(
inputs=[{'txid': coin['txid'], 'vout': coin['vout'], "sequence": 0xffffffff}], # SEQUENCE_FINAL
- outputs=[{node.getnewaddress(): 0.025}],
+ outputs=[{node.getnewaddress(): output_amount}],
locktime=node.getblockcount() + 2000, # Can be anything
))['hex']
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_final)))
+ fee_expected = int(coin['amount']) - output_amount
self.check_mempool_result(
- result_expected=[{'txid': tx.rehash(), 'allowed': True}],
+ result_expected=[{'txid': tx.rehash(), 'allowed': True, 'vsize': 188, 'fees': {'base': Decimal(str(fee_expected))}}],
rawtxs=[tx.serialize().hex()],
maxfeerate=0,
)
@@ -127,7 +130,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_0)))
txid_0 = tx.rehash()
self.check_mempool_result(
- result_expected=[{'txid': txid_0, 'allowed': True}],
+ result_expected=[{'txid': txid_0, 'allowed': True, 'vsize': 110, 'fees': {'base': Decimal(str(2 * fee))}}],
rawtxs=[raw_tx_0],
)
@@ -187,7 +190,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
tx.deserialize(BytesIO(hex_str_to_bytes(raw_tx_reference)))
# Reference tx should be valid on itself
self.check_mempool_result(
- result_expected=[{'txid': tx.rehash(), 'allowed': True}],
+ result_expected=[{'txid': tx.rehash(), 'allowed': True, 'vsize': 110, 'fees': { 'base': Decimal(str(0.1 - 0.05))}}],
rawtxs=[tx.serialize().hex()],
maxfeerate=0,
)