return err
}
- var signersSigns [][][]byte
+ inputsCnt := getInputsCnt(destTx)
+ signersSigns := make([][][]byte, inputsCnt)
signerSigns, err := w.getSigns(destTx, ormTx)
if err != nil {
return err
}
- // TODO: pass ref?
- signersSigns = w.attachSignsForTx( /*destTx,*/ ormTx, w.position, signerSigns)
+ // TODO: pass ref? err?
+ w.attachSignsForTx( /*destTx,*/ ormTx, signersSigns, w.position, signerSigns)
for _, remote := range w.remotes {
signerSigns, err := remote.RequestSigns(destTx, ormTx)
return err
}
- // TODO: pass ref?
- signersSigns = w.attachSignsForTx( /*destTx,*/ ormTx, remote.Position, signerSigns)
+ // TODO: pass ref? err?
+ w.attachSignsForTx( /*destTx,*/ ormTx, signersSigns, remote.Position, signerSigns)
}
if w.isTxSignsReachQuorum(signersSigns) && w.isLeader() {
return nil
}
+func getInputsCnt(tx interface{}) uint64 {
+ switch tx := tx.(type) {
+ case *btmTypes.Tx:
+ return uint64(len(tx.Inputs))
+ case *vaporTypes.Tx:
+ return uint64(len(tx.Inputs))
+ default:
+ return 0
+ }
+}
+
func (w *warder) validateCrossTx(tx *orm.CrossTransaction) error {
switch tx.Status {
case common.CrossTxRejectedStatus:
}
// TODO:
-func (w *warder) attachSignsForTx(destTx interface{}, ormTx *orm.CrossTransaction, position uint8, signs []string) error {
+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: