"github.com/vapor/toolbar/precog/database/orm"
)
-// TODO: simplify
func (m *monitor) upsertNode(node *config.Node) error {
- if node.XPub != nil {
- node.PublicKey = fmt.Sprintf("%v", node.XPub.PublicKey().String())
- }
-
ormNode := &orm.Node{
IP: node.IP,
Port: node.Port,
ormNode.PublicKey = node.PublicKey
if node.XPub != nil {
ormNode.Xpub = node.XPub.String()
+ ormNode.PublicKey = fmt.Sprintf("%v", node.XPub.PublicKey().String())
}
return m.db.Save(ormNode).Error
}