mirror of
https://github.com/lightninglabs/pool.git
synced 2026-08-19 13:17:51 +02:00
client/rpc: fix panic in sendAcceptBatch
In this commit, we fix a panic in `sendAcceptBatch` due to the fact that the method as is, creates a slice with enough _capacity_ but a zero length. In this case, trying to access an index will result in a panic. In this commit, we shift things over to use append instead of index into the slice.
This commit is contained in:
parent
20a5085017
commit
50a9a3e447
1 changed files with 1 additions and 3 deletions
|
|
@ -1044,10 +1044,8 @@ func (s *rpcServer) sendAcceptBatch(batch *order.Batch) error {
|
|||
// Prepare the list of nonces we accept by serializing them to a slice
|
||||
// of byte slices.
|
||||
nonces := make([][]byte, 0, len(batch.MatchedOrders))
|
||||
idx := 0
|
||||
for nonce := range batch.MatchedOrders {
|
||||
nonces[idx] = nonce[:]
|
||||
idx++
|
||||
nonces = append(nonces, nonce[:])
|
||||
}
|
||||
|
||||
// Send the message to the server.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue