Verify captured BM1366 share through strict pool replay
next-build / build (push) Canceled after 0s

This commit is contained in:
2026-10-15 03:47:59 -06:00
parent eb9dcf830b
commit 2d6233cdc7
4 changed files with 118 additions and 3 deletions
+16 -3
View File
@@ -154,8 +154,8 @@ pub fn parse_configure_response(
}
}
/// Decode both offered BIP310 extensions. The response must explicitly
/// acknowledge each advertised extension before its notifications are used.
/// Decode both offered BIP310 extensions. An omitted extranonce extension is
/// unsupported; its notifications cannot be used without an explicit grant.
pub fn parse_configure_result(
line: &[u8],
request_id: u64,
@@ -168,7 +168,7 @@ pub fn parse_configure_result(
.ok_or(PoolMessageError::InvalidField)?;
let subscribe_extranonce = match result.get("subscribe-extranonce") {
Some(Value::Bool(value)) => *value,
Some(Value::String(_)) => false,
Some(Value::String(_)) | None => false,
_ => return Err(PoolMessageError::InvalidField),
};
Ok(ConfigureResult {
@@ -293,3 +293,16 @@ pub fn parse_notify(line: &[u8], subscription: &Subscription) -> Result<PoolJob,
work,
})
}
#[cfg(test)]
mod configure_tests {
use super::*;
#[test]
fn omitted_extranonce_extension_is_unsupported() {
let line = br#"{"id":1,"result":{"version-rolling":true,"version-rolling.mask":"1fffe000"},"error":null}"#;
let result = parse_configure_result(line, 1).unwrap();
assert!(result.version_mask.is_some());
assert!(!result.subscribe_extranonce);
}
}