File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -774,7 +774,8 @@ impl SignerDb {
774
774
775
775
/// Return whether there was signed block in a tenure (identified by its consensus hash)
776
776
pub fn has_signed_block_in_tenure ( & self , tenure : & ConsensusHash ) -> Result < bool , DBError > {
777
- let query = "SELECT block_info FROM blocks WHERE consensus_hash = ? AND signed_over = 1 DESC LIMIT 1" ;
777
+ let query =
778
+ "SELECT block_info FROM blocks WHERE consensus_hash = ? AND signed_over = 1 LIMIT 1" ;
778
779
let result: Option < String > = query_row ( & self . db , query, [ tenure] ) ?;
779
780
780
781
Ok ( result. is_some ( ) )
@@ -1971,13 +1972,21 @@ mod tests {
1971
1972
assert ! ( db. has_signed_block_in_tenure( & consensus_hash_1) . unwrap( ) ) ;
1972
1973
assert ! ( !db. has_signed_block_in_tenure( & consensus_hash_2) . unwrap( ) ) ;
1973
1974
1975
+ block_info. block . header . consensus_hash = consensus_hash_2;
1974
1976
block_info. block . header . chain_length = 2 ;
1975
1977
block_info. signed_over = false ;
1976
1978
1977
1979
db. insert_block ( & block_info) . unwrap ( ) ;
1978
1980
1979
1981
assert ! ( db. has_signed_block_in_tenure( & consensus_hash_1) . unwrap( ) ) ;
1980
1982
assert ! ( !db. has_signed_block_in_tenure( & consensus_hash_2) . unwrap( ) ) ;
1983
+
1984
+ block_info. signed_over = true ;
1985
+
1986
+ db. insert_block ( & block_info) . unwrap ( ) ;
1987
+
1988
+ assert ! ( db. has_signed_block_in_tenure( & consensus_hash_1) . unwrap( ) ) ;
1989
+ assert ! ( db. has_signed_block_in_tenure( & consensus_hash_2) . unwrap( ) ) ;
1981
1990
}
1982
1991
1983
1992
#[ test]
You can’t perform that action at this time.
0 commit comments