Skip to content

Commit adca9d4

Browse files
committed
refactor: move rejection deletion before acceptance insertion
1 parent f74c622 commit adca9d4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

stacks-signer/src/signerdb.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,12 @@ impl SignerDb {
13231323
signer_addr: &StacksAddress,
13241324
signature: &MessageSignature,
13251325
) -> Result<bool, DBError> {
1326+
// Remove any block rejection entry for this signer and block hash
1327+
let del_qry = "DELETE FROM block_rejection_signer_addrs WHERE signer_signature_hash = ?1 AND signer_addr = ?2";
1328+
let del_args = params![block_sighash, signer_addr.to_string()];
1329+
self.db.execute(del_qry, del_args)?;
1330+
1331+
// Insert the block signature
13261332
let qry = "INSERT OR IGNORE INTO block_signatures (signer_signature_hash, signer_addr, signature) VALUES (?1, ?2, ?3);";
13271333
let args = params![
13281334
block_sighash,
@@ -1335,12 +1341,6 @@ impl SignerDb {
13351341
"signature" => %signature);
13361342

13371343
let rows_added = self.db.execute(qry, args)?;
1338-
1339-
// Remove any block rejection entry for this signer and block hash
1340-
let del_qry = "DELETE FROM block_rejection_signer_addrs WHERE signer_signature_hash = ?1 AND signer_addr = ?2";
1341-
let del_args = params![block_sighash, signer_addr.to_string()];
1342-
self.db.execute(del_qry, del_args)?;
1343-
13441344
Ok(rows_added > 0)
13451345
}
13461346

0 commit comments

Comments
 (0)