All files / lib layout.js

0% Statements 0/3
100% Branches 0/0
100% Functions 0/0
0% Lines 0/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56                                                                                                               
/*!
 * layout.js - data layout for multisig
 * Copyright (c) 2018, The Bcoin Developers (MIT License).
 * https://github.com/bcoin-org/bcoin
 */
 
'use strict';
 
const bdb = require('bdb');
 
/*
 * Multisig wallet database layout:
 *  V -> db version
 *  O -> flags for network verification
 *  w[wid] -> wallet
 *  W[wid] -> wallet id
 *  l[id] -> wid
 *  p[wid]* -> proposaldb
 */
 
exports.msdb = {
  V: bdb.key('V'),
  O: bdb.key('O'),
  w: bdb.key('w', ['uint32']),
  W: bdb.key('W', ['uint32']),
  l: bdb.key('l', ['ascii']),
  p: bdb.key('p', ['uint32'])
};
 
/*
 * Proposal Database layout:
 *  D -> proposal id depth
 *  S -> proposal db stats
 *  p[pid] -> proposal
 *  t[pid] -> transaction (value is also store with proposal)
 *  e[pid] -> dummy (pending proposals)
 *  f[pid] -> dummy (finished proposals)
 *  c[hash][index] -> dummy (locked coins)
 *  C[pid][hash][index] -> dummy (locked coins by proposal)
 *  P[hash][index] -> pid (proposals by coins)
 */
 
exports.proposaldb = {
  prefix: bdb.key('p', ['uint32']),
 
  D: bdb.key('D'),
  S: bdb.key('S'),
  p: bdb.key('p', ['uint32']),
  t: bdb.key('t', ['uint32']),
  e: bdb.key('e', ['uint32']),
  f: bdb.key('f', ['uint32']),
  c: bdb.key('c', ['hash256', 'uint32']),
  C: bdb.key('C', ['uint32', 'hash256', 'uint32']),
  P: bdb.key('P', ['hash256', 'uint32'])
};