[precog_schema.sql](./sql_dump/precog_schema.sql)
### Config
+run with [config_example.json](docs/precog/config_example.json)
+```
+go run cmd/precog/main.go docs/precog/config_example.json
+```
## API
"github.com/jinzhu/gorm"
+ "github.com/vapor/netsync/peers"
"github.com/vapor/toolbar/precog/config"
"github.com/vapor/toolbar/precog/database/orm"
)
-// TODO:
-// implement logic first, and then refactor
-// /home/gavin/work/go/src/github.com/vapor/
-// p2p/test_util.go
-// p2p/switch_test.go
-
// TODO: get lantency
// TODO: get best_height
// TODO: decide check_height("best best_height" - "confirmations")
Port: ormNode.Port,
}).FirstOrCreate(ormNode).Error
}
+
+func (m *monitor) savePeerInfo(peerInfo *peers.PeerInfo) error {
+ return nil
+}
package monitor
import (
- // "encoding/binary"
- // "encoding/hex"
"fmt"
"io/ioutil"
"os"
- // "os/user"
"strings"
"time"
"github.com/jinzhu/gorm"
log "github.com/sirupsen/logrus"
- // dbm "github.com/vapor/database/leveldb"
vaporCfg "github.com/vapor/config"
"github.com/vapor/crypto/ed25519/chainkd"
dbm "github.com/vapor/database/leveldb"
"github.com/vapor/event"
- "github.com/vapor/p2p"
- // conn "github.com/vapor/p2p/connection"
"github.com/vapor/netsync/chainmgr"
"github.com/vapor/netsync/consensusmgr"
+ "github.com/vapor/p2p"
// msgs "github.com/vapor/netsync/messages"
"github.com/vapor/netsync/peers"
"github.com/vapor/p2p/discover/dht"
if peerInfo.Height > bestHeight {
bestHeight = peerInfo.Height
}
+
+ m.savePeerInfo(peerInfo)
}
log.Info("bestHeight", bestHeight)