mirror of
https://github.com/ElementsProject/lightning.git
synced 2026-08-15 12:50:22 +02:00
This wire file primarily contains datastructures that is used to serialize data for storing in the datastore. We have 2 types of datastores for bwatch. The block history datastore and the watch datastore. For block history we store height, the hash and the hash of the previous block. For watches we have 4 types of watches - utxo, scriptpubkey, scid and blockdepth watches, each of these have their unique info stored in the datastore. The common info for all watches includes the start block and the list of owners interested in watching.
1.3 KiB
1.3 KiB
| 1 | #include <bitcoin/block.h> |
|---|---|
| 2 | #include <bitcoin/tx.h> |
| 3 | # Block record: complete serializable structure |
| 4 | subtype,block_record_wire |
| 5 | subtypedata,block_record_wire,height,u32, |
| 6 | subtypedata,block_record_wire,hash,bitcoin_blkid, |
| 7 | subtypedata,block_record_wire,prev_hash,bitcoin_blkid, |
| 8 | # Watch: complete serializable structure |
| 9 | # Type is stored to enable reconstruction of watch key from wire data |
| 10 | subtype,watch_wire |
| 11 | subtypedata,watch_wire,type,u32, |
| 12 | # Scriptpubkey key (for WATCH_SCRIPTPUBKEY) |
| 13 | subtypedata,watch_wire,scriptpubkey_len,u32, |
| 14 | subtypedata,watch_wire,scriptpubkey,u8,scriptpubkey_len |
| 15 | # Outpoint key (for WATCH_OUTPOINT) |
| 16 | subtypedata,watch_wire,outpoint,bitcoin_outpoint, |
| 17 | # SCID key (for WATCH_SCID) |
| 18 | subtypedata,watch_wire,scid_blockheight,u32, |
| 19 | subtypedata,watch_wire,scid_txindex,u32, |
| 20 | subtypedata,watch_wire,scid_outnum,u32, |
| 21 | # Blockdepth key (for WATCH_BLOCKDEPTH): block where the tx confirmed |
| 22 | subtypedata,watch_wire,blockdepth,u32, |
| 23 | # Common fields |
| 24 | subtypedata,watch_wire,start_block,u32, |
| 25 | subtypedata,watch_wire,num_owners,u16, |
| 26 | subtypedata,watch_wire,owners,wirestring,num_owners |
| 27 | # Messages for datastore persistence - use these to serialize/deserialize |
| 28 | # Each message wraps a single item for storage |
| 29 | msgtype,bwatch_block,1 |
| 30 | msgdata,bwatch_block,block,block_record_wire, |
| 31 | msgtype,bwatch_watch,2 |
| 32 | msgdata,bwatch_watch,watch,watch_wire, |