OSDN Git Service

???
authorHAOYUatHZ <haoyu@protonmail.com>
Fri, 21 Jun 2019 07:50:03 +0000 (15:50 +0800)
committerHAOYUatHZ <haoyu@protonmail.com>
Fri, 21 Jun 2019 07:50:03 +0000 (15:50 +0800)
federation/service/warder.go
federation/warder.go

index ee52bd6..86b66d5 100644 (file)
@@ -23,7 +23,7 @@ func NewWarder(cfg *config.Warder) *Warder {
 // TODO:
 // RequestSign() will request a remote warder to sign a tx, the remote warder
 // will sign the tx, update its tx data & signs data, and response with the signs
-func (w *Warder) RequestSigns(destTx interface{}, ormTx *orm.CrossTransaction) ([]string, error) {
+func (w *Warder) RequestSigns(destTx interface{}, ormTx *orm.CrossTransaction) ([][]byte, error) {
        return nil, nil
 }
 
index 04f8a08..4c0c68f 100644 (file)
@@ -3,7 +3,8 @@ package federation
 import (
        "database/sql"
        "encoding/hex"
-       "encoding/json"
+       // TODO:
+       // "encoding/json"
        "time"
 
        btmTypes "github.com/bytom/protocol/bc/types"
@@ -345,25 +346,11 @@ func (w *warder) getSigns(destTx interface{}, ormTx *orm.CrossTransaction) ([][]
 }
 
 // TODO:
-func (w *warder) attachSignsForTx( /*destTx interface{}, */ ormTx *orm.CrossTransaction, signersSigns [][][]byte, position uint8, signs []string) error {
-       var inputsLen int
-       switch destTx := destTx.(type) {
-       case *vaporTypes.Tx:
-               inputsLen = len(destTx.Inputs)
-       case *btmTypes.Tx:
-               inputsLen = len(destTx.Inputs)
-       default:
-               return errUnknownTxType
-       }
+func (w *warder) attachSignsForTx( /*destTx interface{}, */ ormTx *orm.CrossTransaction, signersSigns [][][]byte, position uint8, signerSigns [][]byte) error {
+       // TODO: rename
+       // signWitness := make([][]string, len(signersSigns))
 
-       // finalize tx?
-
-       signWitness := make([][]string, inputsLen)
-
-       b, err := json.Marshal(signs)
-       if err != nil {
-               return errors.Wrap(err, "marshal signs")
-       }
+       // TODO:
 
        return w.db.Model(&orm.CrossTransactionSign{}).
                Where(&orm.CrossTransactionSign{
@@ -371,7 +358,8 @@ func (w *warder) attachSignsForTx( /*destTx interface{}, */ ormTx *orm.CrossTran
                        WarderID:           w.position,
                }).
                UpdateColumn(&orm.CrossTransactionSign{
-                       Signatures: string(b),
+                       // TODO:
+                       Signatures: "",
                        Status:     common.CrossTxSignCompletedStatus,
                }).Error
 }