You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Make sure the sender is part of our signing set
1008
-
let is_valid_sender = self.signer_addresses.iter().any(|addr| {
1009
-
// it only matters that the address hash bytes match
1010
-
stacker_address.bytes() == addr.bytes()
1011
-
});
1012
-
1013
-
if !is_valid_sender {
1014
-
debug!("{self}: Received pre-commit message from an unknown sender {stacker_address:?}. Will not store.");
1015
-
return;
1016
-
}
1017
1013
1018
1014
ifself.signer_db.has_committed(block_hash, stacker_address).inspect_err(|e| warn!("Failed to check if pre-commit message already considered for {stacker_address:?} for {block_hash}: {e}")).unwrap_or(false){
1019
1015
debug!("{self}: Already considered pre-commit message from {stacker_address:?} for {block_hash}. Ignoring...");
@@ -1643,16 +1639,12 @@ impl Signer {
1643
1639
return;
1644
1640
};
1645
1641
1646
-
let signer_address = StacksAddress::p2pkh(self.mainnet,&public_key);
1647
-
1648
1642
// authenticate the signature -- it must be signed by one of the stacking set
1649
-
let is_valid_sig = self.signer_addresses.iter().any(|addr| {
1650
-
// it only matters that the address hash bytes match
1651
-
signer_address.bytes() == addr.bytes()
1652
-
});
1653
-
1654
-
if !is_valid_sig {
1655
-
debug!("{self}: Receive block rejection with an invalid signature. Will not store.";
1643
+
let signer_address = StacksAddress::p2pkh(self.mainnet,&public_key);
1644
+
if !self.is_valid_signer(&signer_address){
1645
+
debug!("{self}: Received block rejection with an invalid signature. Will not store.";
1646
+
"signer_public_key" => ?public_key,
1647
+
"signer_address" => %signer_address,
1656
1648
"signer_signature_hash" => %block_hash,
1657
1649
"signature" => %signature
1658
1650
);
@@ -1785,20 +1777,17 @@ impl Signer {
1785
1777
};
1786
1778
1787
1779
// authenticate the signature -- it must be signed by one of the stacking set
1788
-
let is_valid_sig = self.signer_addresses.iter().any(|addr| {
1789
-
let stacker_address = StacksAddress::p2pkh(self.mainnet,&public_key);
1790
-
1791
-
// it only matters that the address hash bytes match
1792
-
stacker_address.bytes() == addr.bytes()
1793
-
});
1794
-
1795
-
if !is_valid_sig {
1796
-
debug!("{self}: Receive invalid signature {signature}. Will not store.");
1780
+
let signer_address = StacksAddress::p2pkh(self.mainnet,&public_key);
1781
+
if !self.is_valid_signer(&signer_address){
1782
+
debug!("{self}: Received block acceptance with an invalid signature. Will not store.";
1783
+
"signer_public_key" => ?public_key,
1784
+
"signer_address" => %signer_address,
1785
+
"signer_signature_hash" => %block_hash,
1786
+
"signature" => %signature
1787
+
);
1797
1788
return;
1798
1789
}
1799
1790
1800
-
let signer_address = StacksAddress::p2pkh(self.mainnet,&public_key);
1801
-
1802
1791
// signature is valid! store it.
1803
1792
// if this returns false, it means the signature already exists in the DB, so just return.
1804
1793
if !self
@@ -2036,6 +2025,14 @@ impl Signer {
2036
2025
}
2037
2026
}
2038
2027
2028
+
/// Check if the signer identified by the StacksAddress is part of the signer's list of signer addresses
0 commit comments