mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-10-05 15:56:54 +03:00
Add ability to get the aggsig additional data from full node RPC (#17241)
* add melting related function rpc api * add rpc_client version of new functions * add get_additional_data to rpc and test it * remove melt_cats * remove cat_set_tail * black * lint fix * rpc_client returns bytes32 * black test file
This commit is contained in:
parent
dfe909267e
commit
c4f2595e54
@ -102,6 +102,7 @@ class FullNodeRpcApi:
|
||||
"/get_unfinished_block_headers": self.get_unfinished_block_headers,
|
||||
"/get_network_space": self.get_network_space,
|
||||
"/get_additions_and_removals": self.get_additions_and_removals,
|
||||
"/get_aggsig_additional_data": self.get_aggsig_additional_data,
|
||||
# this function is just here for backwards-compatibility. It will probably
|
||||
# be removed in the future
|
||||
"/get_initial_freeze_period": self.get_initial_freeze_period,
|
||||
@ -805,6 +806,9 @@ class FullNodeRpcApi:
|
||||
"removals": [coin_record_dict_backwards_compat(cr.to_json_dict()) for cr in removals],
|
||||
}
|
||||
|
||||
async def get_aggsig_additional_data(self, _: Dict[str, Any]) -> EndpointResult:
|
||||
return {"additional_data": self.service.constants.AGG_SIG_ME_ADDITIONAL_DATA.hex()}
|
||||
|
||||
async def get_all_mempool_tx_ids(self, _: Dict[str, Any]) -> EndpointResult:
|
||||
ids = list(self.service.mempool_manager.mempool.all_item_ids())
|
||||
return {"tx_ids": ids}
|
||||
|
@ -159,6 +159,10 @@ class FullNodeRpcClient(RpcClient):
|
||||
response = await self.fetch("get_coin_records_by_parent_ids", d)
|
||||
return [CoinRecord.from_json_dict(coin_record_dict_backwards_compat(coin)) for coin in response["coin_records"]]
|
||||
|
||||
async def get_aggsig_additional_data(self) -> bytes32:
|
||||
result = await self.fetch("get_aggsig_additional_data", {})
|
||||
return bytes32.from_hexstr(result["additional_data"])
|
||||
|
||||
async def get_coin_records_by_hint(
|
||||
self,
|
||||
hint: bytes32,
|
||||
|
@ -631,6 +631,10 @@ async def test_get_blockchain_state(one_wallet_and_one_simulator_services, self_
|
||||
# When supplying genesis block, there are no older blocks so `None` should be returned
|
||||
assert await get_average_block_time(full_node_api_1.full_node.blockchain, block_records[0], 4608) is None
|
||||
assert await get_average_block_time(full_node_api_1.full_node.blockchain, block_records[-1], 4608) is not None
|
||||
# Test that get_aggsig_additional_data() returns correctly
|
||||
assert (
|
||||
full_node_api_1.full_node.constants.AGG_SIG_ME_ADDITIONAL_DATA == await client.get_aggsig_additional_data()
|
||||
)
|
||||
|
||||
finally:
|
||||
# Checks that the RPC manages to stop the node
|
||||
|
Loading…
Reference in New Issue
Block a user