@@ -1068,7 +1068,7 @@ fn voter_persists_its_votes() {
1068
1068
drop ( _block_import) ;
1069
1069
r
1070
1070
} )
1071
- } ;
1071
+ }
1072
1072
1073
1073
runtime. spawn ( alice_voter1) ;
1074
1074
@@ -1110,7 +1110,7 @@ fn voter_persists_its_votes() {
1110
1110
let runtime_handle = runtime_handle. clone ( ) ;
1111
1111
1112
1112
async move {
1113
- if state. compare_and_swap ( 0 , 1 , Ordering :: SeqCst ) == 0 {
1113
+ if state. compare_exchange ( 0 , 1 , Ordering :: SeqCst , Ordering :: SeqCst ) . unwrap ( ) == 0 {
1114
1114
// the first message we receive should be a prevote from alice.
1115
1115
let prevote = match signed. message {
1116
1116
finality_grandpa:: Message :: Prevote ( prevote) => prevote,
@@ -1156,7 +1156,7 @@ fn voter_persists_its_votes() {
1156
1156
// we send in a loop including a delay until items are received, this can be
1157
1157
// ignored for the sake of reduced complexity.
1158
1158
Pin :: new ( & mut * round_tx. lock ( ) ) . start_send ( finality_grandpa:: Message :: Prevote ( prevote) ) . unwrap ( ) ;
1159
- } else if state. compare_and_swap ( 1 , 2 , Ordering :: SeqCst ) == 1 {
1159
+ } else if state. compare_exchange ( 1 , 2 , Ordering :: SeqCst , Ordering :: SeqCst ) . unwrap ( ) == 1 {
1160
1160
// the next message we receive should be our own prevote
1161
1161
let prevote = match signed. message {
1162
1162
finality_grandpa:: Message :: Prevote ( prevote) => prevote,
@@ -1170,7 +1170,7 @@ fn voter_persists_its_votes() {
1170
1170
// therefore we won't ever receive it again since it will be a
1171
1171
// known message on the gossip layer
1172
1172
1173
- } else if state. compare_and_swap ( 2 , 3 , Ordering :: SeqCst ) == 2 {
1173
+ } else if state. compare_exchange ( 2 , 3 , Ordering :: SeqCst , Ordering :: SeqCst ) . unwrap ( ) == 2 {
1174
1174
// we then receive a precommit from alice for block 15
1175
1175
// even though we casted a prevote for block 30
1176
1176
let precommit = match signed. message {
0 commit comments