Exemple #1
0
// NewBlockTree create buckets in blockdb if does not exist.
func NewBlockTree() *BlockTree {
	blocks, err := bucket.New([]byte("blocks"), db)
	if err != nil {
		panic(err)
	}

	tree, err := bucket.New([]byte("block_tree"), db)
	if err != nil {
		panic(err)
	}

	return &BlockTree{
		blocks: blocks,
		tree:   tree,
	}
}
Exemple #2
0
// New create a transaction db instance.
func newTransactionsBkt(db *bolt.DB) (*transactions, error) {
	txBkt, err := bucket.New([]byte("transactions"), db)
	if err != nil {
		return nil, nil
	}

	return &transactions{bkt: txBkt}, nil
}
Exemple #3
0
func newAddressUx(db *bolt.DB, name []byte) (*addressUx, error) {
	bkt, err := bucket.New(name, db)
	if err != nil {
		return nil, err
	}

	return &addressUx{bkt}, nil
}
Exemple #4
0
func NewBlockSigs() *BlockSigs {
	sigs, err := bucket.New([]byte("block_sigs"), db)
	if err != nil {
		panic(err)
	}

	return &BlockSigs{
		Sigs: sigs,
	}
}