func (l *Local) Database() *DB {
	return l.db
}
Database returns the node database associated with the local peer.
package peer
import (
	"net"
	"sync"
	"github.com/iotaledger/hive.go/autopeering/peer/service"
	"github.com/iotaledger/hive.go/autopeering/salt"
	"github.com/iotaledger/hive.go/crypto/ed25519"
	"github.com/iotaledger/hive.go/identity"
)
type Local struct {
	*Peer
	identity *identity.LocalIdentity
	db       *DB
	mu            sync.RWMutex
	serviceRecord *service.Record
	publicSalt    *salt.Salt
	privateSalt   *salt.Salt
}
func newLocal(key ed25519.PrivateKey, ip net.IP, serviceRecord *service.Record, db *DB) *Local {
	id := identity.New(key.Public())
	return &Local{
		Peer:          NewPeer(id, ip, serviceRecord),
		identity:      identity.NewLocalIdentityWithIdentity(id, key),
		db:            db,
		serviceRecord: serviceRecord,
	}
}
func NewLocal(ip net.IP, serviceRecord *service.Record, db *DB, seed ...[]byte) (*Local, error) {
	var key ed25519.PrivateKey
	if len(seed) > 0 {
		key = ed25519.PrivateKeyFromSeed(seed[0])
		if db != nil {
			if err := db.UpdateLocalPrivateKey(key); err != nil {
				return nil, err
			}
		}
	} else {
		var err error
		key, err = db.LocalPrivateKey()
		if err != nil {
			return nil, err
		}
	}
	return newLocal(key, ip, serviceRecord, db), nil
}