MCPcopy Create free account
hub / github.com/ElementsProject/lightning / reverse_bitcoin_hash

Function reverse_bitcoin_hash

tests/test_plugin.py:5127–5133  ·  view source on GitHub ↗

Convert Bitcoin hash between display format and wire format. Bitcoin hashes are stored in reverse byte order in the wire protocol compared to how they're displayed in RPC calls.

(hash_hex)

Source from the content-addressed store, hash-verified

5125
5126
5127def reverse_bitcoin_hash(hash_hex):
5128 """Convert Bitcoin hash between display format and wire format.
5129
5130 Bitcoin hashes are stored in reverse byte order in the wire protocol
5131 compared to how they're displayed in RPC calls.
5132 """
5133 return ''.join(reversed([hash_hex[i:i + 2] for i in range(0, len(hash_hex), 2)]))
5134
5135
5136def test_bwatch_add_watch_creates_datastore_entry(node_factory, bitcoind):

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected