Commit eb7d1b37 authored by 李伟@五瓣科技's avatar 李伟@五瓣科技

fix take for

parent 5c719026
...@@ -756,11 +756,13 @@ func (web *WebServicer) sendBatchTxsFromQueue(fromAddr string, toAddrs []string, ...@@ -756,11 +756,13 @@ func (web *WebServicer) sendBatchTxsFromQueue(fromAddr string, toAddrs []string,
var hashesBytes []byte = make([]byte, 0, 32*batchTxHashSize) var hashesBytes []byte = make([]byte, 0, 32*batchTxHashSize)
if txF, ok := txAsInterface.(TxWithFrom); ok { if txF, ok := txAsInterface.(TxWithFrom); ok {
for j := 0; j < batchTxHashSize; j++ { j := 0
for ; j < batchTxHashSize; j++ {
var txsBytes []byte var txsBytes []byte
var batchTxs []TxWithFrom = make([]TxWithFrom, 0, batchTxSize) var batchTxs []TxWithFrom = make([]TxWithFrom, 0, batchTxSize)
for i := 0; i < batchTxSize; i++ { i := 0
for ; i < batchTxSize; i++ {
if k == 0 { if k == 0 {
beginOriginalTx = txF.Tx.Hash() beginOriginalTx = txF.Tx.Hash()
} }
...@@ -778,6 +780,8 @@ func (web *WebServicer) sendBatchTxsFromQueue(fromAddr string, toAddrs []string, ...@@ -778,6 +780,8 @@ func (web *WebServicer) sendBatchTxsFromQueue(fromAddr string, toAddrs []string,
} }
} }
if i == batchTxSize-1 || k == len(txFs)-1 {
h := sha256.New() h := sha256.New()
if _, err := h.Write(txsBytes); err != nil { if _, err := h.Write(txsBytes); err != nil {
return err return err
...@@ -792,6 +796,9 @@ func (web *WebServicer) sendBatchTxsFromQueue(fromAddr string, toAddrs []string, ...@@ -792,6 +796,9 @@ func (web *WebServicer) sendBatchTxsFromQueue(fromAddr string, toAddrs []string,
break break
} }
} }
}
if j == batchTxHashSize-1 || k == len(txFs)-1 {
tx, err := web.cli.BuildTx(&hashesBytes) tx, err := web.cli.BuildTx(&hashesBytes)
...@@ -802,6 +809,8 @@ func (web *WebServicer) sendBatchTxsFromQueue(fromAddr string, toAddrs []string, ...@@ -802,6 +809,8 @@ func (web *WebServicer) sendBatchTxsFromQueue(fromAddr string, toAddrs []string,
consenusTxs = append(consenusTxs, tx) consenusTxs = append(consenusTxs, tx)
consTxWithBatchs = append(consTxWithBatchs, ConsTxWithBatchHash{ConsTxHash: tx.Hash().Bytes(), consTxWithBatchs = append(consTxWithBatchs, ConsTxWithBatchHash{ConsTxHash: tx.Hash().Bytes(),
BatchTxsHash: hashesBytes}) BatchTxsHash: hashesBytes})
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment