• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revisione73e54d195fc9dfdbcfa39ccdd695bfb4ba984ee (tree)
Time2019-06-27 21:29:31
AuthorPaladz <yzhu101@uott...>
CommiterGitHub

Log Message

Merge branch 'master' into fix_lru

Change Summary

Incremental Difference

--- a/README.md
+++ b/README.md
@@ -35,11 +35,10 @@ Firstly, you need initialize node:
3535 $ vapord init --chain_id=vapor --home <vapor-data-path>
3636 ```
3737
38-For example, you can store vapor data in `$HOME/bytom/vapor`:
39-
40-```
41-$ vapord init --chain_id=vapor --home $HOME/bytom/vapor
42-```
38+The default vapor data path (on the host) is:
39++ Mac: `~/Library/Application Support/Vapor`
40++ Linux: `~/.vapor`
41++ Windows: `%APPDATA%\Vapor`
4342
4443 Then, start your node:
4544
--- a/docs/federation/README-en.md
+++ b/docs/federation/README-en.md
@@ -5,14 +5,13 @@ To run a federation node, you will need to:
55 1. init a MySQL database with this [schema](./federation.sql);
66 2. run a `bytomd` node;
77 3. run a `vapord` node and import the federation private key;
8-4. and last but not least, run a `fedd` node with a `fed_cfg.json`.
8+4. and last but not least, run a `fedd` node with a `fed_cfg.json` and it will listen at 9886 port.
99
1010 A `fed_cfg.json` would look like this:
1111
1212 ```json
1313 {
1414 "api" : {
15- "listening_port" : 3000,
1615 "is_release_mode": false
1716 },
1817 "mysql" : {
@@ -127,7 +126,7 @@ Optional:
127126
128127 ```js
129128 // Request
130-curl -X POST 127.0.0.1:3000/api/v1/federation/list-crosschain-txs -d '{}'
129+curl -X POST 127.0.0.1:9886/api/v1/federation/list-crosschain-txs -d '{}'
131130
132131 // Result
133132 {
--- a/docs/federation/federation.sql
+++ b/docs/federation/federation.sql
@@ -25,7 +25,7 @@ CREATE TABLE `chains` (
2525 `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
2626 PRIMARY KEY (`id`),
2727 UNIQUE KEY `name` (`name`),
28- UNIQUE KEY `block_hash` (`block_hash`)
28+ UNIQUE KEY `block_hash` (`id`,`block_hash`)
2929 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3030
3131 LOCK TABLES `chains` WRITE;
--- a/federation/api/server.go
+++ b/federation/api/server.go
@@ -2,7 +2,6 @@ package api
22
33 import (
44 "encoding/json"
5- "fmt"
65 "net/http"
76 "reflect"
87 "strings"
@@ -43,7 +42,7 @@ func (server *Server) setupRouter() {
4342 }
4443
4544 func (s *Server) Run() {
46- s.engine.Run(fmt.Sprintf(":%d", s.cfg.API.ListeningPort))
45+ s.engine.Run(":9886")
4746 }
4847
4948 func (s *Server) middleware() gin.HandlerFunc {
--- a/federation/config/config.go
+++ b/federation/config/config.go
@@ -42,8 +42,7 @@ type Config struct {
4242 }
4343
4444 type API struct {
45- ListeningPort uint64 `json:"listening_port"`
46- IsReleaseMode bool `json:"is_release_mode"`
45+ IsReleaseMode bool `json:"is_release_mode"`
4746 }
4847
4948 type MySQLConfig struct {
--- a/federation/database/orm/asset.go
+++ b/federation/database/orm/asset.go
@@ -5,7 +5,7 @@ import (
55 )
66
77 type Asset struct {
8- ID uint64 `gorm:"primary_key" json:"-"`
8+ ID uint64 `gorm:"primary_key;foreignkey:ID" json:"-"`
99 AssetID string `json:"asset_id"`
1010 IssuanceProgram string `json:"-"`
1111 VMVersion uint64 `json:"-"`
--- a/federation/database/orm/cross_transaction_req.go
+++ b/federation/database/orm/cross_transaction_req.go
@@ -17,5 +17,5 @@ type CrossTransactionReq struct {
1717 UpdatedAt types.Timestamp `json:"-"`
1818
1919 CrossTransaction *CrossTransaction `gorm:"foreignkey:CrossTransactionID" json:"-"`
20- Asset *Asset `gorm:"foreignkey:ID" json:"asset"`
20+ Asset *Asset `json:"asset"`
2121 }
Show on old repository browser