mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Implement REST mempool API, add test and documentation.
This commit is contained in:
@@ -292,6 +292,19 @@ class RESTTest (BitcoinTestFramework):
|
||||
txs.append(self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11))
|
||||
self.sync_all()
|
||||
|
||||
# check that there are exactly 3 transactions in the TX memory pool before generating the block
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/mempool/info'+self.FORMAT_SEPARATOR+'json')
|
||||
json_obj = json.loads(json_string)
|
||||
assert_equal(json_obj['size'], 3)
|
||||
# the size of the memory pool should be greater than 3x ~100 bytes
|
||||
assert_greater_than(json_obj['bytes'], 300)
|
||||
|
||||
# check that there are our submitted transactions in the TX memory pool
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/mempool/contents'+self.FORMAT_SEPARATOR+'json')
|
||||
json_obj = json.loads(json_string)
|
||||
for tx in txs:
|
||||
assert_equal(tx in json_obj, True)
|
||||
|
||||
# now mine the transactions
|
||||
newblockhash = self.nodes[1].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
Reference in New Issue
Block a user