waddrmgr: remove old migration logic
In this commit, we remove the old upgrade/migration logic of the address manager as it's been superseded by the new approach using the migration.Manager interface.
This commit is contained in:
parent
2fb234c68f
commit
f582eab1fa
2 changed files with 0 additions and 52 deletions
|
@ -11,7 +11,6 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcwallet/walletdb"
|
||||
)
|
||||
|
@ -2101,46 +2100,3 @@ func createManagerNS(ns walletdb.ReadWriteBucket,
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// upgradeManager upgrades the data in the provided manager namespace to newer
|
||||
// versions as neeeded.
|
||||
func upgradeManager(db walletdb.DB, namespaceKey []byte, pubPassPhrase []byte,
|
||||
chainParams *chaincfg.Params, cbs *OpenCallbacks) error {
|
||||
|
||||
var version uint32
|
||||
err := walletdb.View(db, func(tx walletdb.ReadTx) error {
|
||||
ns := tx.ReadBucket(namespaceKey)
|
||||
var err error
|
||||
version, err = fetchManagerVersion(ns)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
str := "failed to fetch version for update"
|
||||
return managerError(ErrDatabase, str, err)
|
||||
}
|
||||
|
||||
if version < 5 {
|
||||
err := walletdb.Update(db, func(tx walletdb.ReadWriteTx) error {
|
||||
ns := tx.ReadWriteBucket(namespaceKey)
|
||||
return upgradeToVersion5(ns)
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// The manager is now at version 5.
|
||||
version = 5
|
||||
}
|
||||
|
||||
// Ensure the manager is upraded to the latest version. This check is
|
||||
// to intentionally cause a failure if the manager version is updated
|
||||
// without writing code to handle the upgrade.
|
||||
if version < latestMgrVersion {
|
||||
str := fmt.Sprintf("the latest manager version is %d, but the "+
|
||||
"current version after upgrades is only %d",
|
||||
latestMgrVersion, version)
|
||||
return managerError(ErrUpgrade, str, nil)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1522,14 +1522,6 @@ func Open(ns walletdb.ReadBucket, pubPassphrase []byte,
|
|||
return loadManager(ns, pubPassphrase, chainParams)
|
||||
}
|
||||
|
||||
// DoUpgrades performs any necessary upgrades to the address manager contained
|
||||
// in the wallet database, namespaced by the top level bucket key namespaceKey.
|
||||
func DoUpgrades(db walletdb.DB, namespaceKey []byte, pubPassphrase []byte,
|
||||
chainParams *chaincfg.Params, cbs *OpenCallbacks) error {
|
||||
|
||||
return upgradeManager(db, namespaceKey, pubPassphrase, chainParams, cbs)
|
||||
}
|
||||
|
||||
// createManagerKeyScope creates a new key scoped for a target manager's scope.
|
||||
// This partitions key derivation for a particular purpose+coin tuple, allowing
|
||||
// multiple address derivation schems to be maintained concurrently.
|
||||
|
|
Loading…
Reference in a new issue