fix: add unit test and change log entry

This commit is contained in:
Jude Nelson
2023-03-01 12:22:34 -05:00
parent 7638dfceb3
commit ebce622b84
2 changed files with 26 additions and 0 deletions

View File

@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the versioning scheme outlined in the [README.md](README.md).
## [Unreleased]
### Fixed
- Handle the case where a bitcoin node returns zero headers (#3588)
## [2.1]
This is a **consensus-breaking** release that introduces a _lot_ of new

View File

@@ -1832,4 +1832,24 @@ mod test {
let deserialized: Vec<Vec<u8>> = deserialize(&encoded_tx).unwrap();
}
#[test]
fn test_handle_headers_empty() {
let headers_path = "/tmp/test-spv-handle_headers_empty.dat";
if fs::metadata(headers_path).is_ok() {
fs::remove_file(headers_path).unwrap();
}
let mut spv_client = SpvClient::new(
headers_path,
0,
None,
BitcoinNetworkType::Regtest,
true,
false,
)
.unwrap();
spv_client.handle_headers(1, vec![]).unwrap();
}
}