Merge pull request #1872 from Roasbeef/create-proper-buckets

channeldb: fix bucket creation hierarchy in createChannelDB
This commit is contained in:
Olaoluwa Osuntokun 2018-09-11 16:04:40 -07:00 committed by GitHub
commit d050cedd02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 11 deletions

View File

@ -70,12 +70,6 @@ var (
// channel closure. This key should be accessed from within the
// sub-bucket of a target channel, identified by its channel point.
revocationLogBucket = []byte("revocation-log-key")
// fwdPackageLogBucket is a bucket that stores the locked-in htlcs after
// having received a revocation from the remote party. The keys in this
// bucket represent the remote height at which these htlcs were
// accepted.
fwdPackageLogBucket = []byte("fwd-package-log-key")
)
var (

View File

@ -201,29 +201,63 @@ func createChannelDB(dbPath string) error {
if _, err := tx.CreateBucket(openChannelBucket); err != nil {
return err
}
if _, err := tx.CreateBucket(closedChannelBucket); err != nil {
return err
}
if _, err := tx.CreateBucket(forwardingLogBucket); err != nil {
return err
}
if _, err := tx.CreateBucket(fwdPackagesKey); err != nil {
return err
}
if _, err := tx.CreateBucket(invoiceBucket); err != nil {
return err
}
if _, err := tx.CreateBucket(paymentBucket); err != nil {
return err
}
if _, err := tx.CreateBucket(nodeInfoBucket); err != nil {
return err
}
if _, err := tx.CreateBucket(nodeBucket); err != nil {
nodes, err := tx.CreateBucket(nodeBucket)
if err != nil {
return err
}
if _, err := tx.CreateBucket(edgeBucket); err != nil {
_, err = nodes.CreateBucket(aliasIndexBucket)
if err != nil {
return err
}
if _, err := tx.CreateBucket(edgeIndexBucket); err != nil {
_, err = nodes.CreateBucket(nodeUpdateIndexBucket)
if err != nil {
return err
}
if _, err := tx.CreateBucket(graphMetaBucket); err != nil {
edges, err := tx.CreateBucket(edgeBucket)
if err != nil {
return err
}
if _, err := edges.CreateBucket(edgeIndexBucket); err != nil {
return err
}
if _, err := edges.CreateBucket(edgeUpdateIndexBucket); err != nil {
return err
}
if _, err := edges.CreateBucket(channelPointBucket); err != nil {
return err
}
graphMeta, err := tx.CreateBucket(graphMetaBucket)
if err != nil {
return err
}
_, err = graphMeta.CreateBucket(pruneLogBucket)
if err != nil {
return err
}