• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revisionc2d610da0dd5cea754e66f8f2b2a3d02125bc97b (tree)
Time2019-05-23 00:58:52
AuthorChengcheng Zhang <943420582@qq.c...>
CommiterChengcheng Zhang

Log Message

update

Change Summary

Incremental Difference

--- a/account/accounts.go
+++ b/account/accounts.go
@@ -122,6 +122,32 @@ type Manager struct {
122122 accountMu sync.Mutex
123123 }
124124
125+type EdSigner struct {
126+ Type string `json:"type"`
127+ XPubs []edchainkd.XPub `json:"xpubs"`
128+ Quorum int `json:"quorum"`
129+ KeyIndex uint64 `json:"key_index"`
130+ DeriveRule uint8 `json:"derive_rule"`
131+}
132+
133+type EdAccount struct {
134+ *EdSigner
135+ ID string `json:"id"`
136+ Alias string `json:"alias"`
137+}
138+
139+// func (account *Account) UnmarshalJSON(b []byte) error {
140+// edAccount := new(EdAccount)
141+// if err := json.Unmarshal(b, edAccount); err != nil {
142+// return err
143+// }
144+
145+// account.Type = edAccount.Type
146+// switch xpubs := acc
147+// account.XPubs{edAccount.XPubs}
148+// return nil
149+// }
150+
125151 // NewManager creates a new account manager
126152 func NewManager(walletDB dbm.DB, chain *protocol.Chain) *Manager {
127153 return &Manager{
@@ -155,7 +181,7 @@ func CreateAccount(xpubs []crypto.XPubKeyer, quorum int, alias string, acctIndex
155181 }
156182
157183 func (m *Manager) saveAccount(account *Account, updateIndex bool) error {
158- fmt.Println("account.XPubs is:", account.XPubs)
184+ fmt.Println("saveAccount account.XPubs is:", account)
159185 rawAccount, err := json.Marshal(account)
160186 ///////
161187 fmt.Println("rawaccount is:", rawAccount)
--- a/crypto/ed25519/chainkd/serialize.go
+++ b/crypto/ed25519/chainkd/serialize.go
@@ -60,3 +60,8 @@ func (xprv *XPrv) UnmarshalText(inp []byte) error {
6060 func (xprv XPrv) String() string {
6161 return hex.EncodeToString(xprv.Bytes())
6262 }
63+
64+// func (xpub *XPub) UnmarshalJSON(b []byte) error {
65+
66+// return nil
67+// }
Show on old repository browser