@@ -602,15 +602,15 @@ func (b *batch) addSweeps(ctx context.Context, sweeps []*sweep) (bool, error) {
602
602
}
603
603
604
604
// Track if there is a presigned and a regular sweep.
605
- var hasPresigned , hasRegular bool
605
+ var addingPresigned , addingRegular bool
606
606
for _ , s := range sweeps {
607
607
if s .presigned {
608
- hasPresigned = true
608
+ addingPresigned = true
609
609
} else {
610
- hasRegular = true
610
+ addingRegular = true
611
611
}
612
612
}
613
- if hasPresigned && hasRegular {
613
+ if addingPresigned && addingRegular {
614
614
b .Warnf ("There are presigned and regular sweeps in the group" )
615
615
616
616
return false , nil
@@ -619,7 +619,7 @@ func (b *batch) addSweeps(ctx context.Context, sweeps []*sweep) (bool, error) {
619
619
// If presigned mode is enabled, we should first presign the new version
620
620
// of batch transaction. Also ensure that all the sweeps in the batch
621
621
// use the same mode (presigned or regular).
622
- if hasPresigned {
622
+ if addingPresigned {
623
623
// Ensure that all the sweeps in the batch use presigned mode.
624
624
for _ , s := range b .sweeps {
625
625
if ! s .presigned {
@@ -662,6 +662,18 @@ func (b *batch) addSweeps(ctx context.Context, sweeps []*sweep) (bool, error) {
662
662
" this input: %v" ,
663
663
sweeps [0 ].swapHash [:6 ], err )
664
664
665
+ return false , nil
666
+ }
667
+ }
668
+ } else {
669
+ // Ensure that all the sweeps in the batch don't use presigned.
670
+ for _ , s := range b .sweeps {
671
+ if s .presigned {
672
+ b .Warnf ("failed to add a non-presigned sweep " +
673
+ "%x to the batch, because the batch " +
674
+ "has presigned sweep %x" ,
675
+ sweeps [0 ].swapHash [:6 ], s .swapHash [:6 ])
676
+
665
677
return false , nil
666
678
}
667
679
}
0 commit comments