예제 #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,
	}
}
예제 #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
}
예제 #3
0
파일: address.go 프로젝트: skycoin/skycoin
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
}
예제 #4
0
func NewBlockSigs() *BlockSigs {
	sigs, err := bucket.New([]byte("block_sigs"), db)
	if err != nil {
		panic(err)
	}

	return &BlockSigs{
		Sigs: sigs,
	}
}