mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
tools/generate-wire: use amount_msat / amount_sat for peer protocol.
Basically we tell it that every field ending in '_msat' is a struct amount_msat, and 'satoshis' is an amount_sat. The exceptions are channel_update's fee_base_msat which is a u32, and final_incorrect_htlc_amount's incoming_htlc_amt which is also a 'struct amount_msat'. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -22,6 +22,8 @@ type2size = {
|
||||
'struct bitcoin_blkid': 32,
|
||||
'struct bitcoin_txid': 32,
|
||||
'struct secret': 32,
|
||||
'struct amount_msat': 8,
|
||||
'struct amount_sat': 8,
|
||||
'u64': 8,
|
||||
'u32': 4,
|
||||
'u16': 2,
|
||||
@@ -79,7 +81,9 @@ typemap = {
|
||||
('channel_announcement', 'short_channel_id'): FieldType('struct short_channel_id'),
|
||||
('channel_update', 'short_channel_id'): FieldType('struct short_channel_id'),
|
||||
('revoke_and_ack', 'per_commitment_secret'): FieldType('struct secret'),
|
||||
('channel_reestablish_option_data_loss_protect', 'your_last_per_commitment_secret'): FieldType('struct secret')
|
||||
('channel_reestablish_option_data_loss_protect', 'your_last_per_commitment_secret'): FieldType('struct secret'),
|
||||
('channel_update', 'fee_base_msat'): FieldType('u32'),
|
||||
('final_incorrect_htlc_amount', 'incoming_htlc_amt'): FieldType('struct amount_msat'),
|
||||
}
|
||||
|
||||
# Partial names that map to a datatype
|
||||
@@ -90,6 +94,8 @@ partialtypemap = {
|
||||
'chain_hash': FieldType('struct bitcoin_blkid'),
|
||||
'funding_txid': FieldType('struct bitcoin_txid'),
|
||||
'pad': FieldType('pad'),
|
||||
'msat': FieldType('struct amount_msat'),
|
||||
'satoshis': FieldType('struct amount_sat'),
|
||||
}
|
||||
|
||||
# Size to typename match
|
||||
|
||||
Reference in New Issue
Block a user