bitcoind: use correct endianness for block hashes.

Like txids, we need to reverse them.  We didn't, but then we only used them
to pass to/from bitcoind.  We're about to get them from the block header,
so we need to fix that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-04-24 19:41:20 +09:30
parent e7b9a913a6
commit e60b1b4efa
3 changed files with 36 additions and 17 deletions

View File

@@ -36,3 +36,15 @@ struct bitcoin_block *bitcoin_block_from_hex(const tal_t *ctx,
tal_free(linear_tx);
return b;
}
bool bitcoin_blkid_from_hex(const char *hexstr, size_t hexstr_len,
struct sha256_double *blockid)
{
return bitcoin_txid_from_hex(hexstr, hexstr_len, blockid);
}
bool bitcoin_blkid_to_hex(const struct sha256_double *blockid,
char *hexstr, size_t hexstr_len)
{
return bitcoin_txid_to_hex(blockid, hexstr, hexstr_len);
}