bitcoin: create new wrapper type bitcoin_blkid, log backward endianness.

It's just a sha256_double, but importantly when we convert it to a
string (in type_to_string, which is used in logging) we use
bitcoin_blkid_to_hex() so it's reversed as people expect.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-12-18 17:14:10 +10:30
parent 0237e0b28c
commit 810abb6b21
27 changed files with 92 additions and 73 deletions

View File

@@ -18,7 +18,7 @@ type2size = {
'struct preimage': 32,
'struct pubkey': 33,
'struct sha256': 32,
'struct sha256_double': 32,
'struct bitcoin_blkid': 32,
'struct bitcoin_txid': 32,
'u64': 8,
'u32': 4,
@@ -78,7 +78,7 @@ partialtypemap = {
'signature': FieldType('secp256k1_ecdsa_signature'),
'features': FieldType('u8'),
'channel_id': FieldType('struct channel_id'),
'chain_hash': FieldType('struct sha256_double'),
'chain_hash': FieldType('struct bitcoin_blkid'),
'funding_txid': FieldType('struct bitcoin_txid'),
'pad': FieldType('pad'),
}